This is my first time to create DataEntity Extension (A). In my the last post, I create an DataEntity Extension. Then I add one table(T) and one Entity(B) to be the datasource of A. Now the new DataEntity have some records are repetitive because they have different VaildFrom.
How can I write code to select the newest VaildFrom if records are repetitive? And this is DataEntity Extension, how can I add my code to it?
Can I have some examples or references?
Thank you very much!
Can't you select records by validfrom descending ?
Do you want to have just a single record with the latest ValidFrom date? In that case, instead of adding the datasource and include new fields, you can better include computed columns. docs.microsoft.com/.../data-entity-computed-columns-virtual-fields
I assume the datasource is from a VTS source. The "duplicates" you mentioned are because of a one-to-many relation that occurs because of the VTS fact.
There is an option on the data entity datasource node named "Apply Date Filter". Set it to yes and then pull the ValidFrom and ValidTo fields into the data entity field list (you will get a compile time error if you don't).
Then when you query the data entity you should get only the current valid record from the VTS table. And no more "duplicates".
A good example is CustCustomerV3Entity: click Data Sources -> CustTable -> Data Sources -> DirPartyBaseEntity -> Data Sources -> LogisticsPostalAddressBaseEntity. Then notice the property "Apply Date Filter". Also DirPartyBaseEntity: DirPartyTable -> DirPersonForName -> DirPersonName
What kind of method I can use for Entity Extension to select records by validfrom descending? I saw there are two function called "insertEntityDataSource" and "updateEntityDataSource". Can I use those two methods? If I can, how should I write code for it? Might I have some tricks for it?
What joins you specified in the datasource ? And what is the value specified on Entity datasource valid time state update property?
I want to link two Entity "BankPositivePayExportEntity" and "VendorPaymentJournalLineEntity", so I followed link idea from "VendorPaymentJournalLineEntity" to add "LedgerJournalTrans" and "LogisticsPostalAddressBaseEntity" to "BankPositivePayExportEntity". I add some field from "LogisticsPostalAddressBaseEntity".
The Valid time State Update for both Datasources are "CreateNewTimePeriod"
Business Applications communities