1. Ingmar Thomassen
  2. PowerServer
  3. Monday, 21 November 2022 12:03 PM UTC

Hi

I experience problems with the GOTO function in appeon mobile

Is this function still working on tablet, and IF not is there an other function to skip a peace of code.

 

Example

 

IF li_x = 1 THEN

     ........
ELSE
     GOTO STOP
END IF

 

IF li_x = 1 THEN
        ........

ELSE
      ......
END IF

 

STOP:

 

PB 2019 RB

Appeon workspace 2670

Accepted Answer
Olan Knight Accepted Answer Pending Moderation
  1. Monday, 21 November 2022 16:57 PM UTC
  2. PowerServer
  3. # Permalink

<Personal rant>

There is NOTHING wrong about using a GOTO statement in structured programming, as long as the flow of the logic is clear and concise, and you are not creating spagetti code. Often, using a GOTO is far easier to read and debug than would be the equivalent set of nested IF statements. Just remember that when at all possible to use s SINGLE entry and exit point from any event or function.

Another advantage of using the GOTO/Label construct is a clean flow from multiple conditions.

IF (condition A) THEN GOTO Check_Option_B
...processing
IF (this occurs) THEN GOTO Exit_Function


IF (condition B) THEN GOTO Check_Option_B
...processing
IF (that occurs) THEN GOTO Exit_Function


IF (condition C) THEN GOTO Check_Option_B
...processing
IF (the other thing occurs) THEN GOTO Exit_Function


IF (condition D) THEN GOTO Check_Option_B
...processing


Check_Option_B:
IF (conditions are met) THEN

   ...do this processing
END IF

Exit_Function:
   RETURN


</Personal rant>

Comment
  1. Andreas Mykonios
  2. Monday, 21 November 2022 17:10 PM UTC
Hi Olan.

The limitation comes from Powerserver. Goto isn't supported.
  1. Helpful
  1. Olan Knight
  2. Tuesday, 22 November 2022 23:34 PM UTC
I know. This is just my reaction to generic "GOTOs are bad" statements.
  1. Helpful
  1. Ingmar Thomassen
  2. Tuesday, 29 November 2022 08:28 AM UTC
Thanks, I found GOTO very usefull and quick. To bad it's not supported
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 21 November 2022 12:38 PM UTC
  2. PowerServer
  3. # 1

Hi.

Goto statement isn't supported in appeon powerserver 2020... See the following link:

PowerScript Statements - - Workarounds & APIs Guide (appeon.com)

Andreas.

Comment
  1. Chris Pollach @Appeon
  2. Monday, 21 November 2022 16:38 PM UTC
Correct Anfreas as PS2020 is based on the jScript language where the GOTO is non-existent. However, this command is supported in PS 2021/2022 & higher. ;-)
  1. Helpful 1
  1. Andreas Mykonios
  2. Monday, 21 November 2022 17:12 PM UTC
Yes, but as he works with PB 2019 he is on the old PowerServer.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 23 November 2022 00:03 AM UTC
Same JScript issue Andreas on that PS release as well.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.