Composite key workaround?

Composite key workaround?

  
Hi,

Since you cannot have a composite key in AP: how do you 'workaround' this? Let's say I have a Questions entity with an identifier 'Id' and an Answers entity where the Questions Id (FK) and Answers Id together must be Unique.

Regards, Harry

Hello Harry,

You can create a unique index with the two fields.
To create an index you can right click the entity and select the option "More...", then a dialog window will open whith variois tabs, select indexes tab, click New button to create a new index, give it a name, select the attributes that you want, and dont forget to change the index property "Unique" to "Yes".
With the index created, if you try to insert duplicate records, a exception will be thrown from the database indicating that the index is being violated, and the record will not be inserted.

Hope that helps.

Best Regards,
Nuno Guedes.
Hi Nuno,

I tried this but I am getting an error if I try to create a link from a listwebscreen to an editwebscreen (the intelliwarp way) in entity2. Can you see why? OML is attached.

Regards, Harry    
Hi Harry,

That is because your Id2 Query parameter is declared as Integer, and should be declared as Entity2 Identifier.

Regards, Nuno.
Hi Nuno,

Yes that makes sense. Thanks.

Shouldn't this be handled properly by Intelliwarp though?

Regards, Harry
Hi Harry,

I'm glad that it worked for you.
I think that intelliwarp should handle it but unfortunatly i can't answer to that, you see i am just a comunity member (like you) and i am not aware of all the intelliwarp behaviors, if you think that is a intelliwrap problem you should contact OutSystems directly and exlain the problem.

Regards, Nuno.