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

Strange issue with formula

Status
Not open for further replies.

frankyberry

Programmer
Mar 15, 2007
33
US
I originally posted this in the wrong forum...Sorry.


using CR 8.
When I use the below formula, it appears that the formula returns a null, so I'm using the IsNull() to trap it.
If I comment lines 4 & 5, I return "N/A". If I don't it continues to return a null...

any ideas??


Code:
whilereadingrecords;
StringVar x;
StringVar Array Places;
Places[UBound(Places)] := {VW_GEO.LOCATIONS}; //Line 4
Redim Preserve Places[UBound(Places) + 1];    //Line 5

If IsNull({VW_GEO.LOCATIONS}) Then
    x := "N/A"


Let me elaborate on what I want...
The array Places may contain a particular location, if it does, I want it to display "Y", else "N" but if the field {VW_GEO.LOCATIONS} is null, I want it to display "N" as well...

Here is my formula that handles everything fine except nulls...


Code:
whilereadingrecords;
StringVar x;
StringVar Array Places;
Places[UBound(Places)] := {VW_GEO.LOCATIONS}; //Line 4
Redim Preserve Places[UBound(Places) + 1];    //Line 5

//If IsNull({VW_GEO.LOCATIONS}) Then
//    x := "N/A"

If "Store" in Places Then
   x := 'Y'
Else
   x := 'N'
 
Reverse lines 4 and 5.

You neeed to make room forvalues PRIOR to adding something.

The second formula shows the isnull check commented out so that might explain your problem.

Try showing x at the end...:

whilereadingrecords;
StringVar x;
StringVar Array Places;
Redim Preserve Places[UBound(Places) + 1]; //Line 5
Places[UBound(Places)] := {VW_GEO.LOCATIONS}; //Line 4
If IsNull({VW_GEO.LOCATIONS}) Then
x := "N/A";
If "Store" in Places Then
x := 'Y'
Else
x := 'N';
x

-k
 
I have reversed 4 & 5, thanks for seeing that!

The result is still the same...

My IF statement is as follows:
Code:
If IsNull(VW_GEO.LOCATIONS) Then
    x := 'N';

If "Stores" in Places Then
    x := 'Y'
Else 
    x := 'N';
x

Same issue, weird...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top