Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Is there anyway to do this? Gosub to a string

Author
Message
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 2nd May 2007 20:47 Edited at: 2nd May 2007 20:48


Or something similar?

Thanks
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2007 21:42
Not in the way you describe.

The closest is to Gosub a procedure based on a string with If..Endifs.

TDK_Man

Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 2nd May 2007 21:53
That looks like something that could be done in Perl, but not DarkBasic. I think TDK is right. If...Endif or case statements would be your best bet.

I don't know anything about Lua scripting but that may also be a possibility.
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 2nd May 2007 22:55
I guess i'll have to use if... endif then, thanks a lot for the quick replys
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 3rd May 2007 03:55
You could also do this with a SWITCH CASE statement, & then code it into your own Gosub Function like GosubStr(string value).

Ensure you specify a DEFAULT CASE or some error checking in case the string provided doesn't exist as a label.

I'll try to see if there is a DLL out there to do this. I'm sure Ian M has one (As he seems to have a DLL for everything!)


I'm not at a computer right now with DBpro installed and I don't want to give you code that doesn't work. I'll be home in about 2 hours, and I'll edit an example in to this post.

Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 3rd May 2007 05:59
Don't it. Ever.

This looks similar to the old "atlter to procede to" command that was removed from COBOL over 25 years ago.

It is one of the fastes ways to make your code unreadabel and destroy any semblance of structure.

But, I could be wrong.


Whatever...

Login to post a reply

Server time is: 2024-11-25 19:36:30
Your offset time is: 2024-11-25 19:36:30