Replace function

hi,
is it possible to use a replace function inside template configuration?

e.g.
I have

{{#if Substitute}}


Official Deputy: {{Substitute}}

{{/if}}

{{Substitute}} comes as domain\name, and I want to remove existing domain name from {{Substitute}}

br,
Alex

Hi Alex,
Thanks for getting in touch.

First, I recommend you to use a class of “substitute” instead of an id as it will appear probably more than once in your chart.
Then you can use the class and write a custom JavaScript code to skip the URL and show only the name.

Please send a screenshot of the results you’re getting in your chart now so I can help you write the correct script to do it.

Best regards,
Andre Lima,
Plumsail Team.

Thank you for the hint :wink:
I was trying to use Handlebars #replace

solved it now using jQuery:

renderer.onTooltipRendered(function(event, tooltip, itemData){ var substitute = itemData.Substitute; $('.substitute').text(substitute.replace('domain\\','')); });
br,
Alex

Hi Alex,
Good to know that you made it work.

Replace HandleBars should work for this too.

Best regards,
Andre Lima
Plumsail Team.

Hi Andre,

the {{#replace}} function seems not to be a part of loaded Handlebar scripts which are shipped with Orgchart.

br, Alex