TeleFlow Forums
http://teleflow.org/phpbb/

Variable comparations
http://teleflow.org/phpbb/viewtopic.php?f=10&t=82
Page 1 of 1

Author:  netscon [ Fri Jan 16, 2004 12:52 pm ]
Post subject: 

I'm trying to compare a variable (from a visual fox pro database @VARIABLE) with a variable entered by the user (@MYVARIABLE). <br>User enters 7 digits, so Teleflow sets this @MYVARIABLE as integer. <br>The database @VARIABLE is declared on the database as string(9) even when its contents are just 7 digits, so @VARIABLE equals the 7 digits plus 2 blank spaces. <br>Whe I try to campare @MYVARIABLE vs @VARIABLE its never true because one is integer:"1234567" and the other is string:"1234567 " (note the 2 blank spaces). <br>What I'm doing now is to substract the first seven possitions out from @VARIABLE, and then compare it. This way works but... <br>My question is: Is it possible to convert the string variable (@VARIABLE) to integer?

Author:  Chris [ Fri Jan 16, 2004 1:16 pm ]
Post subject: 

Although you can't quite "convert the string to an integer", there are some easy things you can do to accomplish the same thing, particularly since spaces are the problem. <br> <br>The first suggestion I would make is to see if the ODBC drivers you are using support any functions like "TRIM", which will remove spaces from the field when they are returned to your variable. Then you could easily compare the two 'space free' variables as integers. (Unless you have a good ODBC driver for VFP, you will probably find it has very limited functionality, and that what it does have works very poorly.) <br> <br>So, failing that, there is a Template flowchart that ships with TeleFlow Designer that will do the same. Go to the TAP screen of your application. In the Steps Toolbox there is a "Templates" tab. Click on the "RightTrim" flowchart, and drop it into your application. Whenever you retrieve a character/string variable from the database, pass that variable into the "RightTrim" flowchart (in its first parameter). The variable will be updated to contain the same value it had before, without the trailing spaces.

Author:  netscon [ Fri Jan 16, 2004 1:41 pm ]
Post subject: 

Ok... Thank you very much

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/