Topic Options
#56687 - 01/29/19 06:51 PM build email address from variables
Darrin Lingle Offline
OL Newbie

Registered: 01/29/19
Posts: 4
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.

Top
#56688 - 01/30/19 05:06 AM Re: build email address from variables [Re: Darrin Lingle]
stuartg Offline
OL Expert

Registered: 03/06/03
Posts: 713
Loc: Swindon, England
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))

Top
#56690 - 01/30/19 12:40 PM Re: build email address from variables [Re: Darrin Lingle]
Darrin Lingle Offline
OL Newbie

Registered: 01/29/19
Posts: 4
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

Top
#56691 - 01/30/19 12:57 PM Re: build email address from variables [Re: Darrin Lingle]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 651
Loc: Québec, Canada
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');
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#56696 - 02/01/19 03:38 PM Re: build email address from variables [Re: Darrin Lingle]
Darrin Lingle Offline
OL Newbie

Registered: 01/29/19
Posts: 4
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 ?

Top
#56697 - 02/01/19 05:40 PM Re: build email address from variables [Re: Darrin Lingle]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 651
Loc: Québec, Canada
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.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top