Thanks, Denis.
I got some examples from previous threads and modified them to come up with a server script as follows.
It is pretty close to what you suggested (perhaps less elegant) but seems to work. Do you see any pitfalls in it?
ExistingPriorAidBeginDate = rc.lookup("ExistingPriorAidBeginDate") # ExistingPriorAidBeginDate is the variable in my Fetch Text
existingyear = rc.lookup("existingyear")
if ExistingPriorAidBeginDate.endswith("2014"):
existingyear = "2014"
rc.setGlobal("existingyear", existingyear)
Then back in QFTest, I check the value of existinyear and perform steps as needed.
From: GAUTHIER Denis [mailto:Denis.Gauthier@?.au]
Sent: Monday, January 06, 2014 2:59 PM
To: Adesh Siddhu; 'qftest-list@xxxxxx'
Subject: RE: How To Manipulate A String?
[@@ OPEN @@]
Hi Adesh,
The easiest way would be to use a ‘Check Text’ node instead of a ‘Fetch Text’.
In the ‘Check Text’ node, use the same Client and Component id as the ones you used in your ‘Fetch Text’ node.
In the Text field, enter something like:
.*YYYY
With YYYY substituted by the value you want (it can be a variable in the $(…) syntax)
Do not forget to tick the ‘As regexp’ button.
You can use a more elaborate regexp if you want, the above example corresponds to a endswith() test.
Now if you want to stick to your ‘Fetch Text’ node, right after this node insert a ‘Server Script’ node and insert the following script:
text = rc.getStr(“variable_to_check”) # replace with the name of the variable you used in the ‘Fetch Text’ node
if text.endswith(“YYYY”): # Replace with the actual YYYY value you want to check against
rc.logError(“The year is not correct”)
else:
rc.logMessage(“The year is correct”)
Hope this helps,
Cheers,
This message contains OPEN information that is not sensitive and can be freely accessed by people both inside and outside of the Thales Group
This email was classified byGAUTHIER Denis on Tuesday, 7 January 2014 9:59:07 AM
------------------------------------------------------------------------- DISCLAIMER: This e-mail transmission and any documents, files and previous e-mail messages attached to it are private and confidential. They may contain proprietary or copyright material or information that is subject to legal professional privilege. They are for the use of the intended recipient only. Any unauthorised viewing, use, disclosure, copying, alteration, storage or distribution of, or reliance on, this message is strictly prohibited. No part may be reproduced, adapted or transmitted without the written permission of the owner. If you have received this transmission in error, or are not an authorised recipient, please immediately notify the sender by return email, delete this message and all copies from your e-mail system, and destroy any printed copies. Receipt by anyone other than the intended recipient should not be deemed a waiver of any privilege or protection. Thales Australia does not warrant or represent that this e-mail or any documents, files and previous e-mail messages attached are error or virus free. -------------------------------------------------------------------------