Welcome! Log In Create A New Profile

Advanced

Self Referencing SQL Table

Posted by Steven Sitas.pcs.crosspost 
Steven Sitas.pcs.crosspost
Self Referencing SQL Table
July 18, 2008 12:35PM
Hello,
I am trying to use the following MSSQL table with WinDev 12:

-----------------------------------------------------------
create table "pCategory" (
"pCategorySeq" int identity not null,
"pCategoryID" varchar(10) not null,
"pCategoryDescr" varchar(80) not null,
"pCategoryFather" int null) ON 'PRIMARY'
go
alter table "pCategory"
add constraint "pCategory_PK" primary key clustered ("pCategorySeq")
go

/* Add the remaining keys, constraints and indexes for the table "pCategory". */
alter table "pCategory" add constraint "pCategory_ID" unique (
"pCategoryID")
go
alter table "pCategory" add constraint "pCategory_Descr" unique (
"pCategoryDescr")
go
/* Add foreign key constraints to table "pCategory". */
alter table "pCategory"
add constraint "pCategory_pCategory_FK1" foreign key (
"pCategoryFather")
references "pCategory" (
"pCategorySeq") on update no action on delete no action
go

----------------------------------------
When I import the table in Analysis and use RAD/RAD Simple, the pCategoryFather comes as a ComboBox and it is filled from the same table(pCategory) thus doing a
pCategoryFather=pCategorySeq.
If I leave pCategoryFather=Null, everything works as expected.
If I try to give pCategoryFather a value, using the comboBox, WinDev gets confused. It confuses the pCategorySeq (to be added) with the pCategorySeq it retrieves with the comboBox.
In Clarion I would create an Alias to the pCategory file (in the dictionary) and then use this Alias in my ComboBox. So no confuses ....
How would I do it in WinDev12?

Steven Sitas



Message forwarded from pcsoft.us.windev
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: