Text Search & Replace - VisualCron - Forum

Community forum

osirisja
2011-09-02T15:44:20Z
Hi

Further to discussions on the 'Looping' feature request thread, I have also suggested having a TEXT Search/Replace Task. So for example, if we can read in a Text file in a Loop, we can replace values in that Text file either based on particular string patterns, or, even better, by Variable Replacement names.

By example, for Pattern Matching, lets consider we have three variables within VC that holds particular values, say FilePath (which has the value "C:\data\"), FileName (which holds the value "ASCIAirE.asc") and DDefname (which holds the value "ASCIAirE").

We have a Template Control file that has the following values:

PPMFInputName = [PATH][NAME]
TargetName = "C:\ISIS_v72\demo\output\afp\" [NAME] ".AFP"
DEDocDef = [DOCDEF]

We would then need to add logic to search for the patterns, (within square brackets) in a Loop - perhaps using RegExp - and replace them with the relevant variable assigns. Would be a bit tricky to do but achievable I think.

Even better though would be dynamic variable replacement,so, perhaps we would have:

PPMFInputName = {TASK(b81cb374-4976-4faf-a8b5-1f85f3d32e76,FileName)}
TargetName = {TASK(b81cb374-4976-4faf-a8b5-1f85f3d32e76,FileName)}
DEDocDef = {TASK(b81cb374-4976-4faf-a8b5-1f85f3d32e76,DDefName)}

In fact, we probably would only need the variable names and not the VC GUID's?

Either way, we would want to write out a New text Control File to be processed by a batch tool which is completed, such as:

PPMFInputName = "C:\ISIS_v72\data\ASCIAirE.asc"
TargetName = "C:\ISIS_v72\demo\output\afp\ASCIAirE.afp"
DEDocDef = "ASCIAirE"

Is this achievable do you think?

Cheers

Andy
osirisja
2011-09-02T15:58:57Z
Hi

I should have added - I would see each of these strings specified above will have been created in a List/Array variable within the new LOOP feature that is currently being developed, and again, the writing out of the completed control file will be done in a Loop, one string & completed variable value at a time.

Andy

Scroll to Top