Hi,
I want to execute a script on page load and set a card variable based on the output of that script but not the exact script output.
In practice I want to do something like in the page-level Execute shape data field:
[sep:|@]Script:scriptname@Dummies:dummy=1/2@Parameters:MAC=[thisMAC]@Options:NoConfirmation,CloseWhenFinished@SetTrigger=ValueChanged-[sep:|@]SET@CardVariable@newVar@[Param:1/1,101,[CardVar:scriptOutput]|*]@SetTrigger=ValueChangedIt works when I only have the script but not when I have both.
Hi,
There seems to be an issue with how automation scripts are handled in an execute shape data when there are also variable placeholders in that shape data.
The variable placeholder seems to retrigger the data which resolves in the script not being executed, so this will have to be resolved.
As a workaround, it seems that the bug also provides a solution, when not having the ExecuteSetsOnInit as option on the page, the retrigger triggers the script which then triggers the set, setting the variable from the automation script.
This is the shape data I added to the page, this puts the "ASOutput1" from the automation script in the newCardVar variable:
I hope this workaround works for your usecase!
Hi,
Yes currently trying to do that simultaneously at the moment will result in it not working. We have added this issue to our backlog to resolve this issue
The recommendation at the moment is to not use session variables in the execute pagedata field.
What would be the use case of using both initvar and SETs on page level as they do a very similar thing?
Another possible bug: I can’t seem to set the value of newCardVar in your example to a [Param]-placeholder which is using the ASOutput1?
The execute SETs can contain aggregation placeholders like [SUM] and [RegexReplace] which uses variables from the InitVar data field.
For the [param] comment, I dont really understand what you mean with setting it to [Param]-placeholder
In experimenting, I created this:
Script:Test2|||||NoConfirmation,CloseWhenFinished-SET|CardVariable|newCardVar|[cardvar:ASOutput1]|SetTrigger=ValueChanged-SET|Cardvariable|newCardVar2|[Param:956/1,5]|SetTrigger=ValueChanged
Which now sets both the newCardVar and newCardVar2 variables, I did add ExecuteSetsOnInit again because now the automation script will not retrigger as it has no trigger, although i dont know your exact use case
For the sets, you should be able to set the same variables in execute as you can in initvar, now we do recommend that if these sets get very complex to use automation scripts instead as they are more reliable and more performant than running it through Visio
Hi Robin,
Wouldn't it be possible to set the session variable in the script as well?
Passing Automation script output to session variables
Kind Regards,
Jarno
Hi Jarno,
I’m already setting an output variable in the script but it’s a generic script and I want to try to keep it that way. I’m also setting other variables in the Execute shape data field (using other variables set in the InitVar shape data field), not shown above, which I need to keep as well.
In theory, it should work as I think the logic is available. However, when I was testing the script did not always execute when I added another SET with the output session variable. The software team might give more info on that. I’ll reach out to them.
Hi Klaas,
So at the moment it’s impossible to both execute a script & use the script output as a placeholder in a another SET AND also execute unrelated SETs (for example SETs using variables from the InitVar page shape data field) in the Execute page shape data field?