Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AS won't accept NULL values
Message
From
07/10/1997 15:13:14
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00053091
Message ID:
00053582
Views:
28
Barbara -

I'm realizing that I made a simple (but deadly) assumption in the process of all of this that might be of interest to others...

when I began building my full name string, I did NOT explicitly initialize my variable at the top of the routine, like this:

cFullName = ""

but rather started right in on the cFirstname field:

cFullname = alltrim(cFirstName)

and then began appending middle, last and suffix. The routine of course checks for the presence of a middle name and suffix before actually appending them, but assumed that it was ALWAYS being passed at least a legitimate first name and last name. Thus I ended up with null values when that was not the case. Oh well... :)

thanks again.


>Jeff, glad it worked. You might need to go back into your files and do a mass search/replace for Nulls already existing in the table. Once you've gotten rid of them, you won't get any more (you DID retain the new settings, I presume).
>Barbara
>
>>Barbara -
>>
>>thanks, your second suggestion solved the problem.
>>
>>First I checked and found that I did have the physician's primary key field in the patient record accepting null values, and so toggled that back off. It didn't have any effect.
>>
>>Then I added this to the end of my BuildFullname() routine:
>>
>>if isnull(cFullName)
>> cFullName = ""
>>endif
>>
>>return cFullName
>>
>>Problem Solved!
>>
>>Thanks.
>>
>>Jeffery Cotton
>>
>>
>>>>In VFP 5.0a, working in a local view, I am showing a list of patients from a medial record database with the
>>>>following columns:
>>>>
>>>>cFirstname,cMiddlename,cLastname,cChartNumber,PHYSICIAN
>>>>
>>>>PHYSICIAN is just a reference for the user, so I actually build the physician's fullname by calling a routine I
>>>>wrote, BuildFullName:
>>>>
>>>>buildFullName(Physicians.cFirstName, Physicians.cMiddleName, Physicians.cLastName, Physicians.cSuffix)
>>>>AS PHYSICIAN
>>>>
>>>>I store only the primary key of the physician in the patient record, and then use a left outer join to get the
>>>>above result. However, I keep getting the error:
>>>>
>>>>Field PHYSICIAN does not accept null values.
>>>>
>>>>because some patient's don't have a physician assigned to them yet. Is there anything I can do in the syntax to
>>>>force this calculated field to accept null values? I'd rather not change my BuildFullName() routine to return
>>>>"N/A" or whatever.
>>>>
>>>>Thanks.
>>>
>>>2 Suggestions, Jeff:
>>>
>>>First, make sure your tables are set so they don't accept null values. That way the physician ID will be a blank space (for character data) or a 0 (if your IDs are numeric).
>>>
>>>Second, use the IsNull() function or the NVL() function in your BuildFullName function.
>>>
>>>HTH
>>>Barbara
Jeffery Cotton
Berdy Medical Systems
JVCotton@bellatlantic.net
Previous
Reply
Map
View

Click here to load this message in the networking platform