Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 23 MAY 2007 06:22:32PM Michael Slack wrote:

I'm working in an AREV 3.12 application. I need to create a symbolic where I want to use the GOSUB to call routines within the formula to help make it easier to read and work on. Can I use GOSUB with a symbolic formulas? If so, how?

I haven't found anything that says I can or can't use a GOSUB. Assuming I can, my only question is how to return out of the symbolic once I fill the @ANS variable? Can I just use a RETURN command?

What I'm looking at doing is something like:

IF A ] 0 THEN

GOSUB ROUTINE_1

END ELSE

IF B ] 0 THEN
  GOSUB ROUTINE_2
END ELSE
  IF C ] 0 THEN
    GOSUB ROUTINE_3
  END ELSE
    X="
  END
END

END

@ANS=X

(How do I return out of the symbolic from this point?)

ROUTINE_1:

RETURN

ROUTINE_2:

RETURN

ROUTINE_3:

RETURN

I've actually tried this but can't seem to make it work yet.

A=1

X=0

IF A=1 THEN

GOSUB ROUTINE_1

END ELSE

GOSUB ROUTINE_2

END

@ANS=X

RETURN

ROUTINE_1:

X=10

RETURN

ROUTINE_2:

X=20

RETURN

If anyone can point me in the right direction, that would be a big help. Or should I be using GOTOs for what I want to do?

Thanks,

Michael Slack


At 23 MAY 2007 06:39PM Victor Engel wrote:

This works (just tested it):

@ANS='

GOTO LABEL1:

LABEL2:

@ANS := 'LABEL2 '

RETURN

LABEL1:

@ANS := 'LABEL1 '

GOSUB LABEL2

Output is LABEL1 LABEL2


At 23 MAY 2007 06:42PM Karen Oland wrote:

Although you can no doubt do this (or make it even harder to maintain by adding a bunch of goto's), assuming you want to be able to maintain it and maybe upgrade to OI someday, I'd write a true function that did your calculations and put something like:

@ANS=myfunctionname(@RECORD)

in the formula. Your function then gets @record passed in and doesn't have to even much around with global variables. Add @ID if you need it, as well.

Then, anytime you need to make a change or debug it, you can do so with the editor.


At 24 MAY 2007 09:56AM Michael Slack wrote:

Yes, it would be nice to be able to upgrade to OI but I have no say in that. So, I try to use our AREV to it's fullest capabilities.

Yes, I might end up creating a function or subroutine to call from the symbolic. I'm attempting to keep everything in one place, thinking that would make it simpler later for someone else if they have to look at it or touch it in any way. But your point about being able to use the DEBUG in a function is a good one.

Also, my question is an attempt to continue to learn what AREV's capabilities are. Even if I find I can't use a GOSUB, it'll be a good thing to know. If I can use a GOSUB, that to would be good to know and would increase my toolbox of knowledge on AREV.

Thanks,

Michael Slack


At 24 MAY 2007 10:01AM Victor Engel wrote:

If you're going to go that route, you don't even need to pass @RECORD as a parameter. It will already be available.


At 24 MAY 2007 10:13AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

This is a symbolic with a GoSub

pre.code {

  background-color: #E5E5E5;
  border: 1px solid #000000;
  width: 450px;
  padding: 5px;
  font-family: courier, verdana, arial, serif;
  margin: 0px 10px auto;

}

  String=ZZ"
  GoSub ReformatString

Return String

ReformatString:
  String=String : @Id
Return

Trivia - you don't HAVE to return @Ans if you're doing the function return yourself.

The Sprezzatura Group World leaders in all things RevSoft

Revelation Conference 2007, London - Wednesday 27th June Click here to register for the premier Revelation Software EMEA event of 2007


At 24 MAY 2007 11:17AM Michael Slack wrote:

Thank you. That was the key I needed. The "Return String" seems to be the part I was missing. In experimenting with the code you provided, I came up with the symbolic code below as a proof of concept for what I want to create. I'm sure this will be useful in other symbolics also.

Again thank you for your help.

Michael Slack

STRING =ZZ'

NUM_OF_CHARS=LEN(@ID)

GOSUB MAIN

RETURN STRING

MAIN:

IF NUM_OF_CHARS ] 15 THEN
  GOSUB REFORMATSTRING
END ELSE
  GOSUB LENGTHSTRING
END

RETURN

REFORMATSTRING:

STRING=STRING : '_' : @ID

RETURN

LENGTHSTRING:

STRING=NUM_OF_CHARS : '_' : @ID

RETURN


At 25 MAY 2007 02:26PM Karen Oland wrote:

Although true, it's best to write a function as if the record were not in @RECORD. Not only can you then use it when it isn't, it's more likely to work correctly in OI.

And although the original poster says he isn't moving to OI, he may find he is forced into at least AREV32 under OI as the pc's available all start running vista.


At 01 JUN 2007 11:01AM [email protected] wrote:

You certainly like to keep those thinking caps tightly secured

I didn't note anywhere in your question that you had tried this or not. In looking at your code it should work quite well .. you can think of a dict item as a function. each one is a complete routine on its own that returns a value (@ans if set or what ever is RETURN VALUE)

Have you guys yet started playing with Arev32? This will allow you to continue with Arev but remove most all the problems you currently have

DSig

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/59e599e2cd4a470c852572e4007ae9a5.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1