Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Questions about if and variables in scripts

Hi,

i want to run a script before the load script.

set vartest = "Hello";

set newTest = "";

if($(vartest) like 'Hello',

  // Then

  $(newTest) = $(vartest) & ' World!',

  // else

    $(newTest) = $(vartest) & ' how are you?'

);

tbl_name:

LOAD * Inline

[fieldname,

a

b

c

$(newTest) as newTest

];

The script editor shows error´s in the if statement. What´s wrong?

2017-01-25_14h28_20.jpg

Regards,

sam

3 Replies
sunny_talwar

May be this:

set vartest = "Hello";

set newTest = "";

if $(vartest) = 'Hello' THEN

  $(newTest) = $(vartest) & ' World!',

ELSE

  $(newTest) = $(vartest) & ' how are you?'

END IF;

tbl_name:

LOAD fieldname,

           $(newTest) as NewTest;

LOAD * Inline

[fieldname,

a

b

c

];

marcus_sommer

I think it should be more look like this:

set vartest = Hello;

set newTest = "";

if '$(vartest)' = 'Hello' THEN

  let newTest = '$(vartest)' & ' World!',

ELSE

  let newTest = '$(vartest)' & ' how are you?'

END IF;

tbl_name:

LOAD fieldname,

          '$(newTest)' as NewTest;

LOAD * Inline

[fieldname,

a

b

c

];

- Marcus

rahulpawarb
Specialist III
Specialist III

Hello Walter,

Hope you are doing well!

Please modify your script as below:

set vartest = "Hello"; 

LET newTest = if(vartest like "Hello", vartest & ' World!',  vartest & ' how are you?');

TRACE $(newTest);

Thank you!

Rahul