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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IsNull and shared variables

Status
Not open for further replies.

dean12

MIS
Oct 23, 2001
273
US
Doesn't appear to me that I can do this:

shared StringVar abc;

if IsNull(abc) then abc = "xxx"


Seems CR8.5 says "A field is required here" and points to the argument for the IsNull function.

Guess it is not possible to test for nulls on declared variables?
 
so you are passing a variable from Subreport to main and want to know it is null??

rather than use ISNull make the variable = "" when whatever condition exists to cause it then test it like this

shared StringVar abc;

if abc = "" then abc = "xxx"

that should work....also consider adding "WhilePrintingRecords" to the formula...unless the formula is used for grouping or summary purposes I always do this.


Jim Broadbent
 
dean,
I think your field needs to be in brackets
If isnull({abc}) then {abc} = "xyz"

Hope this helps.
 
The definition of IsNull(fld) states that fld must be a valid database, memo, or BLOB field. Using a shared variable is not valid. By the way a shared string variable is equal to "" if not initialized.
 
This will probably throw and error because IsNull requires a TRUE\FALSE answer


Your most likely to have success with

if IsNull({abc})=True then
{abc} = "xxx"


hth...Brad
 
This will probably throw and error because IsNull requires a TRUE\FALSE answer


Your most likely to have success with

if IsNull({abc})=True then
{abc} = "xxx"


hth...Brad
 
Ahhhh, interesting, thanks JoeCrystal, I should have paid better attention to Ngolems post. Apparently you can't use isnull against any variable.

I guess they need to use:

shared StringVar abc;
if abc = "" then
abc := "xxx"

The problem of the = vs. := was the only error.

-k kai@informeddatadecisions.com
 
Well...thank you SV....I was wondering when/if people would get back to my approach :) Jim Broadbent
 
DBA_Frog said:

This will probably throw and error because IsNull requires a TRUE\FALSE answer


Your most likely to have success with

if IsNull({abc})=True then


IsNull requires the name of a field to test for null.
IF requires a true/false argument, but IsNull returns one.

Testing a function like IsNull for True is a waste of execution time - If IsNull() means "if it's true".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top