Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with NUL values
Message
From
05/04/2002 06:53:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00641273
Message ID:
00641304
Views:
12
>Hallo all
>I have a problems with NULL values in characterstrings that I hope I can explain so you understand:
>
>I make a select from an SQL server like this: (“Select cfield1, cfield2 from mytable”,”myCursor”)
>In the result I get some null values in fields that contains no data on the server.
>I present the fields in a form like this: ‘Some text ’+ alltrim(myCursor.cfield1)+’ ‘+alltrim(myCursor.cfield2)
>When both fields contains data, there are no problems, BUT…
>If one of the fields contains a null value, nothing will be displayed in the form.
>If cfield1 have a NULL value, I want this to be displayed: “Some text ”+ the contents in cfield2.
>
>Does anyone have an idea how to manage this?
>
>My only solutions right now is to…
>1. replace all NULL values with a single space in the whole 'myCursor' before I use it.
>2. replace all NULL values with a single space in the whole table on the server, and allways save new records with spaces in the fields which the user has left empty.
>
>But I feel that its not any good solutions.
>
>Thanks in advance
>/Kjell

Replace has the side effect SQL source would be updated with blanks when they should stay null.
As an additon to Vlad's :
'Some text '+ ;
alltrim(nvl(myCursor.cfield1,'')-(' '+nvl(myCursor.cfield2,'')))

PS: Alltrim might be needed inside.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform