Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
NihalCakir
Contributor
Contributor

Set and call variable in an if statement

Hi, 

I thought this would be pretty easy, but somehow I am stuck. I want to be able to select the desired vVariante by simple removing the comment in order to switch between RealLife, Prototyp and Version 1. And then the variables vZahlungen and vGebühren shall be set so that I can use the correct ones when loading my files. Nevertheless it does not work. When I create a textbox with $(vVariante ) it is empty.  


//Set vVariante = 'RealLife';
Set vVariante = 'Prototyp';
//Set vVariante = 'Version 1';


If $(vVariante) = 'RealLife' Then
   Set vZahlungen = 'Zahlungen';
   Set vGebühren = 'Gebühren';
ElseIf $(vVariante) = 'Prototyp' Then
   Set vZahlungen = 'Zahlungen Prototyp';
   Set vGebühren = 'Gebühren Prototyp';
ElseIf $(vVariante) = 'Version 1' Then
  Set vZahlungen = 'Zahlungen Var 1' ;
  Set vGebühren = 'Gebühren';
Else
   Set vZahlungen = 'not available' ;
   Set vGebühren = 'not available';
End If;

 

 

What do I do wrong?? Thank you

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

//Set vVariante = 'RealLife';
Set vVariante = 'Prototyp';
//Set vVariante = 'Version 1';


If '$(vVariante)' = 'RealLife' Then
Set vZahlungen = 'Zahlungen';
Set vGebühren = 'Gebühren';
ElseIf '$(vVariante)' = 'Prototyp' Then
Set vZahlungen = 'Zahlungen Prototyp';
Set vGebühren = 'Gebühren Prototyp';
ElseIf '$(vVariante)' = 'Version 1' Then
Set vZahlungen = 'Zahlungen Var 1' ;
Set vGebühren = 'Gebühren';
Else
Set vZahlungen = 'not available' ;
Set vGebühren = 'not available';
End If;

 

You should be referencing the variable encased in quotes so it is used as a string. I recommend using Debug mode to test this sort of thing:

Or_0-1681814872459.png

 

View solution in original post

3 Replies
Or
MVP
MVP

//Set vVariante = 'RealLife';
Set vVariante = 'Prototyp';
//Set vVariante = 'Version 1';


If '$(vVariante)' = 'RealLife' Then
Set vZahlungen = 'Zahlungen';
Set vGebühren = 'Gebühren';
ElseIf '$(vVariante)' = 'Prototyp' Then
Set vZahlungen = 'Zahlungen Prototyp';
Set vGebühren = 'Gebühren Prototyp';
ElseIf '$(vVariante)' = 'Version 1' Then
Set vZahlungen = 'Zahlungen Var 1' ;
Set vGebühren = 'Gebühren';
Else
Set vZahlungen = 'not available' ;
Set vGebühren = 'not available';
End If;

 

You should be referencing the variable encased in quotes so it is used as a string. I recommend using Debug mode to test this sort of thing:

Or_0-1681814872459.png

 

NihalCakir
Contributor
Contributor
Author

Hi, referencing the variable encased in quotes was doing the trick. I tried debug mode but and saw that the variable was not set but couldn't understand why. Thank you for your help!

Or
MVP
MVP

I've made this mistake more than a few times in the past, so I've learned to notice the color highlighting here as an immediate "This is acting like a field instead of a string" telltale.