Compound Primary Keys


Author
Message
Larry Caylor
Larry Caylor
Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

The addition of support for compound primary keys is greatSmile. It would be nice if the framework added a ReadOnly CompoundPrimaryKey Property of type PrimaryKeyValue when generating the designer file for an object. This would save having to code a custom CompoundPrimaryKey property that could be used as a Tag value for listviews, etc. It would also be nice if SeekToPrimayKey included an overload that accepted type PrimayKeyValue instead of having to pass each PrimaryKey individually.

 

-Larry

StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Very valid points, Larry... I'll check on the SeekToPrimaryKey, but I think there is already an overload (or there should be). And there is already a GetPrimaryKeyValue() method on the business object that will return a PrimaryKeyValue object for the CurrentRow and an overload that will allow you to create one for a given row.



But, I'll check on the SeekToPrimaryKey and make sure it's in the next version Smile
Larry Caylor
Larry Caylor
Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)Advanced StrataFrame User (880 reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

Ben,

Thanks for the info, I missed the updates to GetPrimaryKeyValue(). However I’m not clear on how I would use this to set a tag value for say a listview? If I create a custom CompundPrimaryKey Property for my BO, it appears in the drop down list of available tag fields. An Example would help.

-Larry

 

 

StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Oh, I gotcha... you need a property that is created that is bindable, not just the ability to get the property. Yes, I'll look into that Smile
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I have a PK that is
Symol ( char(6) ) + Cntry_code ( char(2)) + from_date ( datetime ) + thru_date ( datetime ))
( I did NOT design it but I wish I knew where the kids of the guy who did go to school ... )


that I would love to use in a tag for a Listview for autonavigate. 

Suggestions? 
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Regardless of the list you are using, you can always use the tag of the row.  However, if you use the new StrataListView, there is a CustomData collection on each row that allows you store ANY type of data you want with a key.  I store all kinds of things in this as it is a collection and can store an data type of anything since it accepts an Object data type as the value.  The key is a string.  But by doing this, you can keep all of the logical data associated to a single row that you need.  It is a real life saver and something that I use all of the time...maybe that is why I put it in there Smile
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Thanks Trent.  I've avoided Stratalistview as I could never find documentation after it first appeared three or so years ago.  And I don't believe at that time there were any builders.

Since I have about 25 listviews so far in this app using the original SF listview, I'd prefer for right now ( as in I have a code drop due at 6pm ) to sync movement in my current listview with the underlying BO.  Short of writing my own SelectedIndexChanged event code is there any way to leverage what the old SF Listview does to use a compound key like this?  I tried passing 4 tags, separated by commas - obviously that doesn't work .

Seems earlier posts in this thread hinted at some other approach?  I'm just not seeing it.

( I promise I will look at stratalistview but the pressure today would not make that an option )
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Charles,

Nice seeing you back in the forum, even thought not for happy reasons Hehe

If I understand your issue correctly, you have a regular SF ListView which you want it to navigate to the correct BO record automatically but the PK value cannot be stored properly in the ListView.Tag, am I right?  What type is your PK?

Could you create a View with a calculate field of your PK, create a BO using the view then use that BO in the ListView?

Edhy Rijo

Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
FWIW I did find the sample (thankfully in C# ) you created back in 2009 for Stratalistview.  I get how it works but there appears to be nothing like AutoNavigate so I am still pretty much on my own writing SelectedIndexChanged code. 

Unless you have some compound key magic on the old LV for me, it looks like I'm going through the lv.SelectedItems[0].Subitems[n].Text to create a search on the BO to get navigation. Sad
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)Advanced StrataFrame User (764 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Hey Eddy

Key is char(6) + char(2) + datetime + datetime

If I understand you correctly, I would use a view that had one char column concatenating the four columns ( with datetimes changed to string ) for my listview.  Ok, that get's me a tag.  But the BO where I'm doing data entry will also need that column as a pk, no?  I think that's what autonavigate looks for is a pk.

Of course, I could make it a customfield property of the BO and then use my own code to navigate to that record,  but I'm not sure that's easier than just building my own bo search in the SelectedIndexChanged out of the four values.
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