cancel
Showing results for 
Search instead for 
Did you mean: 

Script goes directly to and stops at "else if"

Former Member
0 Kudos

Hi!

I was wondering if some of you could tell me why this script is not executing the first If statements but directly going to else if and issues message in the log:

                    Stopped script processing after method session.utils.showOptionDialog().

The logic behind this is to check whether vendor with tax number exists

1) if such tax number exists, there is an additional pop-up to confirm the selection of vendor

      -  further there are two options:

                                                      * if vendor is confirmed - "enter" brings you to next screen for choosing variable

                                                       * if vendor is not confirmed - "enter" must be pressed one more time to get to the next screen (status bar shows                                                            message that vendor is not confirmed)

          - but in case vendor with such number doesn't exist, while search help window is opened, there is a message in the status bar.In this case I want                to close the search help window, go back to the last screen and issue informational pop-up.

but whatever number I enter, system gives the informational pop-up and error into the log:

Sometimes it also issues messages that step3 and step4 failed to fire action.

Any help is welcomed.

Thanks,

Diana

Accepted Solutions (0)

Answers (1)

Answers (1)

holger_khn
Contributor
0 Kudos

Hello.

May you can try it by checking popup box text:

---------------------------------------------------------------------------------------------

if (session.findById("wnd[1]").text <> 'Restrict Value Range') ....

....

....

....

} else if (session.findById("wnd[1]").text = 'Restrict Value Range') ....

....

....

....

---------------------------------------------------------------------------------------------

If search have any results "session.findById("wnd[1]").text" will be something like 'Vendor Account Number x Entries'

Let us know if that will solve your issue. Thanks.

Best regards

Holger

Former Member
0 Kudos

Hi Holger,

I got a little confused how this would work, cause after initial search by tax number, results are displayed in the same window, with the same title and id and text.

Like if there is a vendor, results are shown in the same window which is persistent if there is no vendor

so the system cannot quite identify which is which case. That's why I though maybe i could use status message as indicator, that there is no vendors, but it doesn't work.

Diana

thomas_brutigam2
Active Participant
0 Kudos

Hi Diana,

how are you trying to fetch the Statusbar text ?

In any case every Message has an ID:

Doubleclick on the statusbar if the Message is displayed.
the Performance Assistant will tell you:

For Example


Messagenumber: [anytext]104


[anytext] is a Identifier in that Transaction.
What we wanna know is the last Digets.
This you can retrieve in .findbyId("wnd[0]/usr/sbar").messageId

So there is a way to capture the Error via Statusbar

Greetings

Thomas B

Former Member
0 Kudos

Hi Thomas, thanks for input, but the problem with that part of script works okay either with message ID or text.

Problem is that if there exists such vendor and it is confirmed, it presses Enter twice, but should only once as there are nested if when double-Enter is needed. Seems that system does not recognize it and always presses Enter twice. Where is mistake in the script?

Thanks, Diana

Former Member
0 Kudos

When you test for message number = 224, you have "=" and not "==". That would always be true. Could that be it?

Steve.

Former Member
0 Kudos

Hello Diana,

Let's simplify the code...

IF condition1 { action1 }

ELSE IF condition2 {action2} ...  ;

and I don't see the end of the script...

When you say that it's not executing the first if statement and goes directly to the ELSE IF, you mean that condition1 is always false.

Let's forget what happens after and concentrate on condition1

My suggestion to find out why condition1 is always false: (javascript is far away in my memory so please adjust syntax...)

IF condition1  {action1}

ELSE {

   ALERT("Entering ELSE statement");

   ALERT("sbar.text =//" + session.findbyId("wnd[0]/sbar").text + "//");

   IF   condition2 { ALERT("Condition2 is true");action2} };

And then you can see the content of sbar.text and decide if your condition1 needs to be changed.

Hope this helps...