Shorten Code

Posted by Admin on 13-Oct-2006 06:28

How can I shorten the following code best?

IF adrn.telge BEGINS altTel[1] OR adrn.telgedi BEGINS altTel[1] OR adrn.telpriv

BEGINS altTel[1] OR adrn.faxge BEGINS altTel[1] OR adrn.faxgedi BEGINS

altTel[1] OR adrn.faxpriv BEGINS altTel[1]



adrn.telge = REPLACE(adrn.telge, altTel[1], neuTel[1]).

adrn.telgedi = REPLACE(adrn.telgedi, altTel[1], neuTel[1]).

adrn.telpriv = REPLACE(adrn.telpriv, altTel[1], neuTel[1]).

adrn.faxge = REPLACE(adrn.faxge, altTel[1], neuTel[1]).

adrn.faxgedi = REPLACE(adrn.faxgedi, altTel[1], neuTel[1]).

adrn.faxpriv = REPLACE(adrn.faxpriv, altTel[1], neuTel[1]).

Thank you for your help.

All Replies

Posted by jtownsen on 15-Oct-2006 13:37

Since this discussion is in the testing forum, I don't know whether a reply is expected or not, but if so....

Why would you want to shorten the code particularly?

If you want to make it more efficient, you could change all the statements after the DO: to be a single ASSIGN statement.

Another thing that you might want to do (assuming that you've got lots of prefixes to be changed and that's the reason you have used an array), would be to put it all in a loop (eg. "DO viNumPrefixes = 1 to EXTENT(vcPrefixesArray):" ) and replace all of the instances of" " to "".

Posted by Admin on 16-Oct-2006 05:40

Thank you very much for your Answer

It was very helpful.

Greets Hannes

This thread is closed