Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not Nulls and IIF Not working in DBC VFP6/SP4
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Not Nulls and IIF Not working in DBC VFP6/SP4
Miscellaneous
Thread ID:
00401381
Message ID:
00401381
Views:
67
This started in the Coding/Syntax group but I moved it since it seems purely data-related at this point.

I am having some unexpected behavior with my DBC-living tables.

In the IDE, I have optimistic table buffering set on.

I created a DBC and then stuck a table in it. Then I made a primary key and some candidate keys. On all of the columns I am not allowing null values. In the field-level rule of a column called logically_deleted_yn (not a candidate or primary key), I have
   logically_deleted_yn= ;
     IIF(INLIST(logically_deleted_yn,"Y","N"),;
     logically_deleted_yn,.NULL.)
The behavior I expected was that if I entered anything in the column that was not "Y" or "N", the DBC would put a .null. value in there, and since they are not allowed I would get an error.

To test, I opened up a browse window and typed "G" in there and the DBC took it fine.

What happened?

In addition, I am allowed to APPEND BLANK, change the primary key column, and then APPEND BLANK again; I thought this would violate the uniqueness of all the other columns, since they would be blank and therefore have .null. in them.




Here's what GENDBC says my table looks like:

CREATE TABLE 'INVESTIGATOR_PATIENT_PPLTN.DBF' NAME 'INVESTIGATOR_PATIENT_PPLTN' (INVSTGTR_PATNT_POPLTN_ETHCY_ID N(16, 0) NOT NULL, ;
ETHNIC_GROUP_PC N(6, 2) NULL, ;
SURVEY_DT T NOT NULL, ;
INVESTIGATOR_PARTY_ID N(16, 0) NOT NULL, ;
ETHNICITY_ID N(16, 0) NOT NULL, ;
CREATION_DT T NOT NULL, ;
LAST_UPDATE_DT T NOT NULL, ;
DELETION_DT T NULL, ;
LOGICALLY_DELETED_YN C(1) NOT NULL CHECK logically_deleted_yn=IIF(INLIST(logically_deleted_yn,"Y","N"),logically_deleted_yn,.NULL.), ;
CREATED_BY_USER_ID N(16, 0) NOT NULL, ;
LAST_UPDATE_BY_USER_ID N(16, 0) NOT NULL, ;
DELETED_BY_USER_ID N(16, 0) NOT NULL)

SET COLLATE TO 'MACHINE'
INDEX ON DELETED_BY_USER_ID TAG DELETED_BY
INDEX ON CREATED_BY_USER_ID TAG CREATED_BY
INDEX ON LOGICALLY_DELETED_YN TAG LOGICALLY_
INDEX ON DELETION_DT TAG DELETION_D
INDEX ON LAST_UPDATE_DT TAG LAST_UPDAT
INDEX ON CREATION_DT TAG CREATION_D
INDEX ON ETHNIC_GROUP_PC TAG ETHNIC_GRO
INDEX ON ETHNICITY_ID TAG ETHNICITY_ CANDIDATE
INDEX ON INVESTIGATOR_PARTY_ID TAG INVESTIGAT CANDIDATE
INDEX ON SURVEY_DT TAG SURVEY_DT CANDIDATE
ALTER TABLE 'INVESTIGATOR_PATIENT_PPLTN' ADD PRIMARY KEY INVSTGTR_PATNT_POPLTN_ETHCY_ID TAG INVSTGTR_P
Next
Reply
Map
View

Click here to load this message in the networking platform