cancel
Showing results for 
Search instead for 
Did you mean: 

DateTimeVar is NULL?

Former Member
0 Kudos

Hi,

how can I check if a local variable was initialized or assigned.

local numbervar i;

local datetimevar myDate;

if myDate <> null then

...

else

...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

amrsalem1983
Active Contributor
0 Kudos

if isnull(mydate) then

........

else

..........

is that wat you are looking for? isnull function

good luck

Amr

Former Member
0 Kudos

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