Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index doesn't accept NULL
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00502150
Message ID:
00502164
Views:
24
>>Hi everybody,
>>
>>I have two grids on the form. The main table BldMstr sets relation into Lender table
set rela to left(lname,1) into lender
>>
>>If LName is NULL, I have the error, and my relation doesn't work anymore. What should I do?
>
>I guess you van use NVL function to convert null
>
>
set rela to left(NVL(lname, "?"),1) into lender
>assuming that you dont have lender names beginning with "?"

This is fine, except that I want for NULLs to show all lenders. I solved this problem by adding this code into form init and Grid.AfterRowColChange:
LPARAMETERS nColIndex
if !isnull(lName)
   set relation to left(lname,1) into lender
else
   set relation to
   go top in Lender
endif   
dodefault(m.nColIndex)
local lnRecno
lnRecno=recno('BldMstr')
with this
   .parent.GrdHglt1.Highlight_Row()
   .statusbartext=space(20)+"Record "+ ;
     transform(m.lnRecno)+ ;
     " of "+transform(thisform.NumberOfRecords)+' in '+alias()   
endwith
thisform.navstand.navupdate()
Do you think it's not a good solution? I didn't notice any delays on my test case.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform