-
how to call display method to computed column in d365Hi,
Here's an example of how to write one:
just replace it with your querypublic static server str Id() { return strFmt('select top 1 Id from Table1 as table1 WHERE table1.PARTITION = %1 AND table1.DATAAREAID = %2 AND table1.ParmId = %3 AND table1.Id != %4' , SysComputedColumn::comparisonField(tableStr(EntityTable1), identifierStr(Table1), fieldStr(Table1, Partition)) , SysComputedColumn::comparisonField(tableStr(EntityTable1), identifierStr(Table1), fieldStr(Table1, DataAreaId)) , SysComputedColumn::comparisonField(tableStr(EntityTable1), identifierStr(Table1), fieldStr(Table1, ParmId)) , SysComputedColumn::comparisonField(tableStr(EntityTable1), identifierStr(Table1), fieldStr(Table1, Id)) ); }
Thanks,
Layan Jweihan
Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future -
how to call display method to computed column in d365That's because your SQL code is invalid. Remove the + sign in front of where. You'll also likely have to prefix the field name with a table name. It's beneficial to test the SQL code before using it in a computed column.A serious bug in your code is that you don't take DataAreaId (and Partition) into account.Also, don't hard-coded application object names, such as CustInvoiceTrans. Use intrinsic methods like tableStr(). The compiler will check correctness of such names and cross references will will be recorded for the usage.
-
how to call display method to computed column in d365I have written code like this, but having sync failed to database error
-
how to call display method to computed column in d365Hi,Agree with what Martin says. You will have to rewrite this code either in a computed column directly (which is the best possible scenario) or else use virtual fields and invoke them through postLoad() method (very bad for performance) or in mapEntitytoDataSource methods in the data entity.
-
how to call display method to computed column in d365yes, but we are creating this for entity store
-
how to call display method to computed column in d365Hi,As Martin mentioned the way that you write the code isn't correct. Check the following blogs:Thanks,Waed AyyadIf this helped, please mark it as "Verified" for others facing the same issue
-
how to call display method to computed column in d365A computed column methods returns SQL code to be injected in a SQL view definition. The method shown above doesn't generate SQL code, therefore it's not useful in your scenario. You'd have to rewrite this X++ code to SQL and then write X++ code generating this SQL.A potential alternative is using a virtual field instead of a computed column. Easier to implement, worse for performance.
Helpful resources
Quick Links
Subscribe to
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
Leaderboard
Andre Arnaud de Cal... 283,176 Super User
Martin Dráb 222,727 Super User
nmaenpaa 101,138