Simple script does not work, going bananas

Post your questions and help other users.

Moderator: Martin

Post Reply
angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

Simple script does not work, going bananas

Post by angelatwork » 17 Mar 2014 13:09

Hi,
I have this simple script in a flow :
if (call_type ==1)
{vtelnr = incoming_number
}
else
{vtelnr =called_number
}
and it works, but then I have a similar script that I cannot get to work
if (call_type ==1)
{vinut = "telefonsamtal till"
}
else
{vinut ="telefonsamtal från"
}
But I cannot catch the value. Either I get the last value "telefonsamtal från" Even if it is a incoming call or I get no value or a flow error. I have been trying for a long time to get this simple if.. then.. else.. to work, and it is driving me nuts, so shamefully I am humbly asking for help. I have tried with stating the variable first, I have tried setValue, do I need add list or something else? I should mention that I have separated a long flow into four flows (to be able to reuse some of the flow's for similar purposes).

Help please with this stupid question?
Best regards,
AngelAtwOrk

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Simple script does not work, going bananas

Post by Martin » 17 Mar 2014 18:04

Hi,

You can add log the value to the Automagic log when the script was evaluated and see if the variable has the value you are expecting:
if (call_type ==1)
{vinut = "telefonsamtal till"
}
else
{vinut ="telefonsamtal från"
}
log(vinut);

You could also add a condition Debug Dialog right after the script action to show a dialog with the variables and the corresponding values.

Are you trying to access the variable in the same flow or from another flow? If you want to access the variable in another flow, you can use a global variable instead (for example global_vinut).
Can you describe in more detail how your four flows work? Is one flow calling this flow with an action Execute Flows? If yes, you could also enable options Wait for called flows to finish and Return variables to the calling flow to make the variables visible in the main/parent flow.

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

Re: Simple script does not work, going bananas

Post by angelatwork » 21 Mar 2014 08:03

Thanks for your answer, after days of not getting it to work, it now works as a partial flow. The flow must have broken somewhere else. I will have to buy myself a Android pad so it is easier to check and get a better overview. (Bluestacks on my pc have a bug that I have reported that has not yet been taken care of)
Best regards,
AngelAtwOrk

Post Reply