Workflow setvariable (mathematical operation)

Hi

I’m trying to do a basic operation in PP Workflow, I have this current workflow :

Everything works so far except a local variable affectation.

All I want, is to store the last character of the current filename (%o) into my local variable. But it doesn’t work…

Can I have the proper syntax for this?

Hello Celestor,

The Mathematical Expression field does not support mathematical functions, only expressions. Meaning, the right() function is not supported here.

Here’s a great way to do it in a script, though (this is JavaScript):

var original_filename = Watch.GetOriginalFileName();
Watch.SetVariable("department", original_filename.substr(original_filename.length - 1));

Hope this helps!
~Evie

Wish it did, it stores nothing on the variable sadly :frowning: Drives me a bit crazy for such an easy thing to do. I made sure that I used JavaScript, did a copy paste, yet still nothing written in the variable. How could that be :frowning:

Is there any link / ressources that could show all “planet press” possible objects in programmation (vb, js, etc). (I mean, how can I figure out what member of the Watch class I can consult, there must be a general “dictionnary”?

Just a quick note. Celestor if you simply copied Evie’s code you might not have noticed that she spelled department correctly, however in your math operation it shows that you have a workflow variable spelled depart__e__ment. Its usually the smaller things we miss. Hope this helped.

EDIT: This user guide might help. LINK Page 209 helps with the Watch.GetOriginalFileName and more.

Yeah, I figured it out couple of minutes after :slight_smile:

Thank you for your efficient support :slight_smile:

Regards,

Note that the Workflow User Guide has a whole chapter on using scripts (the last one), you can find it here for 8.3:

http://help.objectiflune.com/en/planetpress-workflow-user-guide/8.3/

You have to use double quotes around your %o variable. The mathematical operation plugin supports simple VBScript function.