Compound Primary Keys


Author
Message
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Tried using a view with the extra column for the BD, but when it does a select for the main BO it still does not create that column.

Am I really being that thick?  I want a calculated column in a BO to persist after a BD gets records.

I am going to try the approach I outline below but I would still appreciate any insight on how to get data from a BD without redefining the structure of the currentdatatable back to the SQL table defined columns

In my biggest SF app to get around this problem I grab the PKs of the BD result, create a datatable that I pass to tablevalued parameter in an SP to get my records ( posted how to do this in user contributed samples a couple years ago. )

Works great for a single key.  The problem here is that I have a compound key ... so as i am writing this, it occurs to me that since I have the mykey in my BD result I can use that single value to pass in as a TVP to an SP that will return my records - and will have the row !

Will report my results.
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)Advanced StrataFrame User (960 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
FWIW I solved the problem like this:

created view for BD bov_Symbology that includes the column mykey which concats the 2 char and 2 datetime columns to a 24 char string mykey

This BD fills that view with its result. 

In browse diaglog closed I grab mykey from the results into List<string> .  That goes to FillbyStringList(List<string> pklist) fill menthod of the bo_Symbology, which also has a customfield property mykey which does the same concat in its accessor

The List<string> is built into a datatable and passed to a stored procedure which has a param that accepts a previously defined Table Valued Parameter ( see my explanation of this technique in User Updates and Samples)

It returns all rows where the 4 columns concatenated make = the char(24) value of the TVP row. ( using a join is easiest)

I have a TVP in the database for int keys as well. 

This is the best way I have found to work around what I see as some major shortcoming of the BD.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search