build email address from variables

Posted by: Darrin Lingle

build email address from variables - 01/29/19 06:51 PM

I'm trying to build an email address from static text + text on the raw input @(x,x,x,x,x) and filling that input with zeros so that the length is always 5 characters long.
I saw someone mention a =left('00000', @location, 5) but that doesn't display right.
Posted by: stuartg

Re: build email address from variables - 01/30/19 05:06 AM

If you want your output prefilled with zeroes use
=right('00000'+@location, 5))
If you want it postfilled with zeroes use
=left(@location+'00000', 5))
Posted by: Darrin Lingle

Re: build email address from variables - 01/30/19 12:40 PM

it's not working.
in the Planet Press Production Configuration, in the Set Job Variables and Properties, I have:

%4 set to inv=right('00000'+@(1,8,8,56,60,KeepCase,NoTrim), 5))@domain.net

it shows this as the result when stepping through:
inv=right('00000'+19000, 5))@domain.net
Posted by: Jean-Cédric

Re: build email address from variables - 01/30/19 12:57 PM

You are trying to use PressTalk in Workflow. That cannot work. PressTalk only exist in the Design tool.

If you want to do this in Workflow, you need to do this through a script.

Attended that your raw input in previously stored in JobInfo1 and the resulting email will be in JobInfo2:

Code:
var rawInput = Watch.GetJobInfo(1);

Watch.SetJobInfo(2, rawInput+'00000'.substr(1,5-rawInput.length)+'@domain.net');
Posted by: Darrin Lingle

Re: build email address from variables - 02/01/19 03:38 PM

i'm not familiar with Watch.GetJobInfo(x) or Watch.SetJobInfo(x). I'm more of a DocForm person.
in your example, rawInput is getting a string from the first array index of GetJobInfo? What is that?
There's not much documentation on this function, but I think it says there are 9 strings about the job.
I have some TalkPress code in Design. Does the code above go there?
is the JobInfo(array-number) accessible from Planet Press Production Configuration as %arraynumber ?
Posted by: Jean-Cédric

Re: build email address from variables - 02/01/19 05:40 PM

This is all linked to the Watch object which can be called by various script.

The code I provided you goes into a Run script plugin in Workflow. Forget about PressTalk. As I said previously, it is only valid in the Design tool.

What my code does is (assuming that the original raw value was put into a JobInfo1 variable before the Run script plugin and that you are expecting the resulting email to be in JobInfo2) it grabs the raw value from JobInfo1 variable, calculate the current length of it, pad with '0', adds the rest of the email address, and stores the resulting into JobInfo2.

Once you are out of the Run script, the resulting email can be found in JobInfo2.