List Icon
Archiv Mailingliste

2019 bis Juli 2022  2018  | 2017 2016 2015 | 2014 | 2013

Die Mailingliste ist seit Juli 2022 geschlossen, dient aber weiterhin als Informationsarchiv zu QF-Test.
Wenn Sie über Neuerungen zu QF-Test informiert bleiben wollen, können Sie einfach unseren Newsletter abonnieren:
Newsletter abonnieren


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] How To Manipulate A String?


  • Subject: Re: [QF-Test] How To Manipulate A String?
  • From: GAUTHIER Denis <Denis.Gauthier@?.au>
  • Date: Wed, 8 Jan 2014 09:15:27 +1100

[@@ OPEN @@]

Hi Adesh,

 

You should be right with your script.

However I would change the rc.setGlobal() to a rc.setLocal(). It is better to limit the scope of your variables otherwise it can become tricky to understand where variables are being set.

 

Cheers,

Denis GAUTHIER

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 Wednesday, 8 January 2014 9:15:27 AM

From: qftest-list-bounces@?.de [mailto:qftest-list-bounces@?.de] On Behalf Of Adesh Siddhu
Sent: Tuesday, 7 January 2014 10:21 AM
To: qftest-list@?.de
Subject: Re: [QF-Test] How To Manipulate A String?

 

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.

 

Adesh Siddhu

 

From: GAUTHIER Denis [mailto:Denis.Gauthier@?.au]
Sent: Monday, January 06, 2014 2:59 PM
To: Adesh Siddhu; 'qftest-list@?.de'
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,

Denis GAUTHIER

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. -------------------------------------------------------------------------

NOTICE: This email message and/or its attachments may contain
information that is confidential or restricted. It is intended only for
the individuals named as recipients in the message. If you are NOT an
authorized recipient, you are prohibited from using, delivering,
distributing, printing, copying, or disclosing the message or content to
others and must delete the message from your computer. If you have
received this message in error, please notify the sender by return
email.

------------------------------------------------------------------------- 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. -------------------------------------------------------------------------