Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dineshmdane
Partner - Contributor III
Partner - Contributor III

Assign variable inside 'If' statement

Hi All,

I have to assign value to a variable inside 'If' statement in an object and not in the script .

Example:

if(second(now())=0,vShow=1,vNext=1)

When I see variable overview the value has not been set for vShow and vNext.

or Please provide some other method to achieve above requirement.

Kindly respond

Regards,

Dinesh M

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

But i see you want this in the front end, not in script. Do you want this to be dynamic and continuously calculated? Define them in the script like this:

Set vNext = '=if(second(now())=0, 1, 0)';

Set vShow = '=if(second(now())=0, 1, 0)';


Now the value will continuously update in the front end (providing you are using QV desktop or the IE plugin).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

6 Replies
Anonymous
Not applicable

Were are you placing the if statement?

and what do you aim to achieve?

jonathandienst
Partner - Champion III
Partner - Champion III

Let vNext = if(second(now())=0, 1, 0);

Let vShow = if(second(now())=0, 1, 0);

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

But i see you want this in the front end, not in script. Do you want this to be dynamic and continuously calculated? Define them in the script like this:

Set vNext = '=if(second(now())=0, 1, 0)';

Set vShow = '=if(second(now())=0, 1, 0)';


Now the value will continuously update in the front end (providing you are using QV desktop or the IE plugin).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
dineshmdane
Partner - Contributor III
Partner - Contributor III
Author

Thanks a lot Jonathan the solution you gave is working .

But the application goes 'not responding' often is there a way to minimize that.

jonathandienst
Partner - Champion III
Partner - Champion III

Now() updates at a millisecond rate, and if there are any expressions affected by vNext or vShow, that may cause your application to recalculate. Are either of these variables part of any chart expressions?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
dineshmdane
Partner - Contributor III
Partner - Contributor III
Author

No, Jonathan the variable  vNext and vShow are not part of any chart.

But, it is a part of variable event trigger which activates sheet when vNext=1 and same for vShow=1.

Thanks & Regards,

Dinesh M