IF condition printing instead of evaluating

Hi,

I have a variable in which I’m trying to use an IF statement due to an admin error in our infrastructure.
The IF statement is as follows;
#{if “#{Tenant.Alias}” == “django”}“djangoinvest-test-integration-app”#{else}"#{Tenant.Alias}-#{Environment.Alias}-Integration-App"#{/if}


The variables are then populating correctly within the IF statement, but the condition is not being evaluated and results as follows;

I’m trying to get the variable Azure.WebApp to paste as ‘djangoinvest-integration-app’ when the client is ‘django’ and for it to be #{client}-#{environment}-integration-app in all other cases as the django-integration-app has already been created in error and is not useable for us.

Thanks,
Archie

Hi @Archie.Lyon,

Thank you for contacting Octopus Support.

I was able to make the if/else logic work in a test environment. However, I was unable to get this to work with nested variables. I’ve reached out internally to see if there is an alternative syntax or workaround that could apply here.

I should have a more complete answer for you shortly. Thanks for your patience.

Regards,
Donny

Hi @Archie.Lyon,

Thank you for your patience.

I was able to get this working. It looks like the #{ in front of the if satisfies the syntax which eliminates the need for an additional $ or #{ } when nesting a variable. See my example below:

Result:
image

Variables:

Script:

Let me know if you have any additional questions.

Regards,
Donny

Hi Donny,

That’s worked for me as well! Thanks a lot for the help :smiley:

Archie

Hi @Archie.Lyon,

Thank you for getting back to me. I’m glad to hear that worked for you.

Please let me know if you have any more questions.

Regards,
Donny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.