on 09-19-2008 7:59 AM
Hi,
how can I check if a local variable was initialized or assigned.
local numbervar i;
local datetimevar myDate;
if myDate <> null then
...
else
...
Hi Patrick
Try this if you are going to use datetimevar as the datatype of the variable:
local datetimevar myDate;
if cstr(myDate) = "" then
something
else
something
Hope this helps.
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whenever you declare any numeric variable without assigning any value then by default the variable value is 0. So we can check when the variable is 0 then it is initialized if not it is assigned.
Raghavendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if isnull(mydate) then
........
else
..........
is that wat you are looking for? isnull function
good luck
Amr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No I do not want to evaluate a database field but a local variable.
It is just to keep complexity of functions small.
So under certain circumstances I assign a db fields value to my local variable. Therefore I check if another dbfield is set.
After that I want to do something only, if local variable was assigned. I do not want to recheck the db-field.
local numbervar i;
if not isnull({command.field1}) then
numbervar := {command.field1};
if not i = null then
...
Regards
Patrick
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.