Normal Topic GOTO Command (Read 1028 times)
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
GOTO Command
Feb 22nd, 2004 at 7:43am
Print Post Print Post  
I'm having a problem with the GOTO command in the following code.  It should return me to the same element after making a selection from the list, but it doesn't, it sends the focus to the next element.

Am I overlooking something here, or is this a bug?  (I used this same basic code in Q&A with proper results.)


if @right(Name, 2) = ".." and @len(Name) > 2 then
    {
    Name = @left(Name, @len(Name) - 2 )
    xuserselectr(@fn, "NewForm!Name", "Name", Name, Name + "zzzzzzzz", Name)
    goto Name
    }
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: GOTO Command
Reply #1 - Feb 22nd, 2004 at 1:18pm
Print Post Print Post  
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: GOTO Command
Reply #2 - Feb 22nd, 2004 at 2:44pm
Print Post Print Post  
Bharat,

Thanks for reminding me.  After re-reading your post, I do remember seeing that already. Embarrassed

I should have done a search before I posted. Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: GOTO Command
Reply #3 - Feb 22nd, 2004 at 6:42pm
Print Post Print Post  
Same Topic....different issue, (Carl's is resolved !)

I have been trying to make a dynamic GOTO by using a variable as the destination.  None of these three works:
=================================
1.
GOTO @CurrentElement()

2.
var vgCurrentElement as String
vgCurrentElement = @CurrentElement()
GOTO vgCurrentElement

3.
var vgCurrentElement as String
vgCurrentElement = "NextElement"    //Any element but current
GOTO vgCurrentElement

I can understand that perhaps the first two do not work because the known issue that cannot do GOTO to self.  But the third option tries to go to any other element but does not work.  Am curious about the logic that prevents this process from being used.

===========================
Another related question re timing of GOTO execution:

I have been experimenting with CurrentElement() and it appears that if I use CurrentElement() in ElementExit Event, that the CurrentElement() value may come back as the next Element as directed by the program vs. the "real" current element where these program lines are originating from.

Hmmmm.....never mind, I will make this a separate Topic: Timing of Events.
http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: GOTO Command
Reply #4 - Feb 22nd, 2004 at 6:53pm
Print Post Print Post  
Bob,

I don't believe that what you are trying to do will be possible, until we implement a variable type in SBasic which can hold an actual element reference. GoTo does not take a string. It takes an element reference.

GoTo FirstName and GoTo "FirstName" are not the same thing.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: GOTO Command
Reply #5 - Feb 22nd, 2004 at 7:15pm
Print Post Print Post  
Thanks for quick reply Erika. 

I won't spend much more time experimenting with that for now.  I guess that also explains why GOTO @Field(NextElement) also will not work (with the desired element name actually bound to NextElement).

A variable type in SBasic which can hold an actual element reference will be a big enhancement for some dynamic programming.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged