Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interpret code that used a field that was a string and now the field is a number

Status
Not open for further replies.

records333

Technical User
Mar 16, 2012
41
US
I inherited a report and I'm learning about variable. I would like assistance of interpreting and recommendations on how to refine:

Extending code that uses a string fieldglobal stringvar a1cvalue := {table.LAST_VALUE};

if mid ({table.LAST_VALUE},4,1) = "-"
then a1cvalue := mid({table.LAST_VALUE},1,3)
else
if mid ({table.LAST_VALUE},5,1) = "-"
then a1cvalue := mid({table.LAST_VALUE},1,4)
else
if mid ({table.LAST_VALUE},3,1) = "-"
then a1cvalue := mid({table.LAST_VALUE},1,2)
else
if mid ({table.LAST_VALUE},2,1) = "-"
then a1cvalue := mid({table.LAST_VALUE},1,1)
else
a1cvalue := "?Val";


I would like to refine the above using a field that is a number vs. a string.
 
global stringvar a1cvalue := totext({table.LAST_VALUE});

You mey need to play with the formatting to get it to match wihat the text field looked like.

 
Are you absolutely certain that the field is now NUMERIC rather than TEXT?

Just because all the CHARACTERS are numeric digits, does not mean that this value is a NUMBER, that is a value that you need to do math with.

An EmployeeID that is all numeric digits is not a NUMBER. It is an IDENTIFIER that happens to be entirely numeric, but you'll NEVER divide the EmployeeID by 2, would you? An IDENTIFIER and a NUMBER are stored differently in you computer.

So I suspect that this field is STILL a TEXT field and ought to be handled as such even if any VALUE has all numeric characters.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top