Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


rdiesel
2010-04-20T19:51:41Z
Hi

I'm struggling to set a user variable in a job which references another user variable (VC 5.5.5)

basically i have 4 tasks...

first task does a PGP decrypt of the file received by a trigger and captures the std output

Quote:

C:\Dev\Airtime\trunk\RunTime.annexures\Applications\Airtime\VisualCRON\SupplierImports\CellC\cellc_enc_OrdX.pgp > C:\Dev\Airtime\trunk\RunTime.annexures\Applications\Airtime\VisualCRON\SupplierImports\CellC\Airtime_TestFile.txt



the second task uses a regular expression to retrieve the resultant file into a user variable X, using a Set Variable Task ie

{REGEX(Replace|{TASK(c307490f-d1d9-46f7-a44e-78a545ddf6cc,StdOut)}|^.*>\s+|)}

the third task (Set Variable) attempts to split the file path up into another variable Y i.e.

{PATH(GetFileName|{USERVAR(X)})}

the problem is that X is correctly initialised whilst Y ends up null or empty.

BTW I am being forced to use this approach because the 4th task which processes the file builds a fairly long commandline which ends up with \n being embedded after certain parameters???? The 4th task process correctly if i hardcode the command line.😠


Sponsor
Forum information
hawkings
2010-04-22T10:27:12Z
I can comment on trailing \n's:
Especially when using output from a cmd execute, there are problems with trailing \n's. I usually remove these by REGEX match, e.g.:
{REGEX(Match|<STRING>|\A[a-zA-Z0-9\>:]*)}

This should remove unwanted newlines. ...although - I am not certain, if this can help you in anyways. 🙂
rdiesel
2010-04-22T13:36:56Z
Ok, turns out that the problem with the embedded \n in the commandline is caused by using a user variable which contains a string which is terminated with a \n (captured through the add/edit user variable dialog). Not quite what one expects?

The major problem for me remains though that I cannot extract the file name from a user variable 'x' assigned to at run time using {PATH(GetFileName|{USERVAR(x)})}

regards
Support
2010-04-22T13:41:56Z
The problem might be that parenthesis exists in the file path. Is that correct?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T14:04:46Z
Definitely no parenthesis in the filename extracted using REGEX.

I use a file task to write the variable out to disk & its 100%.

Is it not possable to duplicate on your system (5.5.5)?

regards
Support
2010-04-22T14:06:19Z
Please give us the path you are having in the user variable (first, try with it yourself directly using the path function).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T14:19:20Z
The following works if i explicitly hardcode the set variable task....


Quote:

{PATH(GetFileName|C:\Dev\Airtime\trunk\RunTime.annexures\Applications\Airtime\VisualCRON\SupplierImports\CellC\Airtime_TestFile.txt)}



The downstream task is given the stripped down file name. So how to get....


Quote:

{PATH(GetFileName|{USERVAR(X)})}

to work?
Support
2010-04-22T14:26:51Z
I am not sure what you mean. We tested putting a file path within a Variable and could successfully use that in the path function.

There seem to be something else within that user Variable?

What you could do is to export you settings and send to us so we can use your user variable directly along with the function.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T14:49:24Z
Have setup a basic VC 5.5.5 job, TestSetVar and have attached the relevant settings, have also attached an encrypted file - which should decrypt as Airtime_TestFile.txt.

This test job is running on Vista
File Attachment(s):
cellc_enc_OrdX.pgp.txt (1kb) downloaded 49 time(s).
Support
2010-04-22T14:51:08Z
Can you verify if the file is really set. You should be able to test this in realtime in the Variables browser.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T15:24:35Z
I'm not sure that I understand your question - if you rename the pgp file cellc_enc_OrdX.pgp.txt to cellc.pgp and drop it into a directory c:\data, then the job should trigger and an output file will appear as per the attachment
File Attachment(s):
pgpstdout.txt (1kb) downloaded 50 time(s).
Support
2010-04-22T15:27:37Z
I am just trying to keep things simple and step by step to see where the problem is without going to any details of your samples.

There is no need for all your Task information if your Variable contains a string. If it does not contain a string then it is not a problem with Variables at all and then you need to look at the Task setup. If it contains a string then we just need to know the exact string you see when viewing/previewing the Variables in the browser.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T16:14:54Z
Hi Henrik

Its a very simple job with just the relevant settings. I have also run this job on Windows Server 2003 and i get exactly the same problem.

Have attached 2 jpg's showing the values of X and Y after running - X should contain the value Airtime_TestFile.txt
rdiesel attached the following image(s):
Support
2010-04-22T17:33:31Z
It seems like you try to store the GetFileName Variable into the other Variable? If you really want to do that way you should check "Convert to constant when running" in the SetVarTask.

I think it is better to not store any Variable during run if you really don't have to.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
rdiesel
2010-04-22T18:04:46Z
Hi Henrik

We receive PGP files from many suppliers of prepaid airtime stock, there is no standard that we can impose on all the suppliers, so we need to process the encrypted PGP file and from the standard output stored by VisualCRON in the PGP Decrypt task we need to parse out the decrypted filename to work with. I have tried to do this in a single step using functions not variables ie
Quote:

{Path(GetFileName|{REGEX(Match|{REGEX(Replace|{TASK(c307490f-d1d9-46f7-a44e-78a545ddf6cc,StdOut)}|^.*>\s+|)}|.*)})}



This did not work, so broke it down into seperate steps and for this i need a variable to hold the results of the evaluation - otherwise what are variables for?

I have tested with the Translate to constant checkbox set - but this has no impact whatsoever.

This task is triggerred when a file arrives in a monitored folder, maybe you should try and duplicate this problem on your side. It is extremely simple to load the job into a VC 5.5.5 server (I only exported the one job) and test it on which ever platform you have available. The PGP keyring is embedded in the settings and you just need to set up a folder c:\Data and drop the .pgp attachment into it.

I am now frustrated as i have spent 3 days writing .Net code which invokes the API to create or update variables and i cannot find any workaround which solves my problem.


Quote:

I think it is better to not store any Variable during run if you really don't have to.



I fully agree with you but it seems that i have to 😕

regards
rdiesel
2010-04-22T18:16:17Z
BTW in a post by hawkings "String replace...bug" you state that....

Quote:

At the moment, for performance, VisualCron only goes 4 levels of Variables down.





{Path(GetFileName|{REGEX(Match|{REGEX(Replace|{TASK(c307490f-d1d9-46f7-a44e-78a545ddf6cc,StdOut)}|^.*>\s+|)}|.*)})} should be ok in terms of what you say, but it fails - so onto variables. 😁
Scroll to Top