A have a view with a union query as datasource. I didn't bother with the index, but now I created a Data Entity from the view, so I need an index. (As a side question: does the entityKey need to be unique? I assume so.)
Is there some documentation I can read or an example to look at?
My first solution was to save use the tableID and recID. But then those fields are included in the export - my boss got a heart attack.
My current solution is saving the SourceTable as an enum and then I have a Description255 field (lets name it sourceIndex) in which I build the index of the source table as a string. For example one of the query datasources is table PurchLine. So MyView.SourceTable = XYZSourceTable::PurchLine and MyView.sourceIndex = PurchLine.PurchId + int2str(PurchLine.LineNumber). Is this solution acceptable?
It still has issues though. Firstly I have no idea what the performance impact is of a Description255 string as part of index. And then one of the other source tables is BankAccountTrans. BankAccountTrans's only unique index and primary index is AcctTransDate which includes RecId. So the resulting string is not very flattering to say the least.
Edit note: I edited the Subject. And then if I may try to state the question better:
I have an entity with a view as datasource. The view is the result of a union query. An entity requires an index. What should I do to accomplish that? I mean a view from a union query has no logical index. A few suggested answers mentions that a view does not need an index (you actually get a BP violation if you do supply one). I did not know that until now, but nevertheless that is not the question. (Yes the subject was incorrectly described - my bad.) The entity needs an index, not the view.
Kind regards
Thanks for reading