Good testing routine... my compliments to the chef
Of course, from what I have seen of your programming abilities this is just par for the course.
Jim Limburg
MikeB wrote:
This is how I am begining the file: ------------------------------------------ SET mess OFF SET VAR vtag INT IF vtag IS NULL THEN DIALOG 'Enter Tag Number' vResponse vendkey 1
You might want to consider the following before you try to make a direct coercion of a variable of type text to a variable of type int in case your user puts an alphabet character in the dialog.
cls label bgproc SET mess OFF SET VAR vtag INT IF vtag IS NULL THEN DIALOG 'Enter Tag Number' vResponse vendkey 1 set var i int = 1 set var len int = (slen(.vResponse)) set var c text set var b text = 'true' while i <= len then set var c=(sget(.vresponse,1,i)) if c Not in ('0','1','2','3','4','5','6','7','8','9') then b = 'false' break endif i = i + 1 endwh if b = 'false' then goto bgproc else clear var i,len,c,b SET VAR vtag =(INT(.vresponse)) endif ret
SET VAR vtag =(INT(.vresponse)) ENDIF ... other stuff that requires .vtag ...
Jim Limburg wrote:
OK, I'll bite
How are you using the variable, or declaring it before hand. I only know of having to use indicator variables if I am pulling the variable information from a tables column info..
Like: SELECT columnname INTO v1 INDICATOR vm_i1 FROM tablename + WHERE columnname = .var_value AND LIMIT = 1
Interesting Jim
James Hageman wrote:
I like that, short and sweet. However it does give a warning about setting the variable to NULL without indicator variable or something, but it still works and holds the assigned value if it is defined. Cool Thanks Jim James
Jim Limburg wrote:
James
Just use
SET VAR v1 TEXT
... or whatever datatype is is delcared to as before. Be sure to keep the datatypes the same though..
Don't set it to null. Doing it this way will not clear the variables setting if it already exist, but well set it to NULL if it doesn't exist.
Jim Limburg
James Hageman wrote:
I want to be able to find out if a variable exists and if not to create it and then pronpt the user to assign a value to it.
I thought I could do something like :
IF (IFEXIST(v1,.v1,NULL)) IS NULL THEN DIALOG 'Enter value for v1' v1 vEndKey 1 ENDIF
But I get an error message telling me v1 doesnt exist, Right! I know.

