Dear all,
I've been working on a product configurator app for my company based on data that we use in our Dynamics 365 CRM environment. I've come a long way using connections to Dynamics Data sources. Today I tried to experiment a bit with making connections to the same entities via CDS.
Currently I'm facing an issue that I don't have problems with when using Dynamics data sources, however I would like to understand how to do it with CDS connections.
I have an entity Products with the field Product (containing the GUID of the record) and I have an entity Projectitem with a LookUp field named Product (in which I can select a Product record). I'm creating a collection in the app in which I'm searching for the product name in the Products entity based on a selection of Projectitem records. For the name I'm using a LookUp:
ForAll( Projectitems; Collect( Selected_Product_Table; { Productname: LookUp( Products; Product = Product; Name ) } ) )
I've tried to specify both Product fields by referring to the entity in the formula, meaning: Products[@Product] = Projectitems[@Product]. I also tried using the unique environment names, but no luck. Basically I've tried all combinations of reference, display names and environment names... no luck.
In the app that I've based on the Dynamics data sources, this LookUp works with specifying the unique environment names.
Can anybody point out what I'm doing wrong and how to build up the correct reference to get the name of the product selected with a LookUp field on a different entity?
Appreciating any feedback!
Best regards,
M.
Solved! Go to Solution.
Dear @yashag2255 ,
Thank you for your reply!
Unfortunately this isn't the solution, however it did help me find the right one - thinking about your comment on not having to use the LookUp function.
For filling the variable 'Productname' in a new collection I now do the following:
ForAll( Projectitems; Collect( Selected_Products_Table; { Productname: Product.Name } ) )
Because I'm doing this for the Projectitems entity (in the ForAll Function) when I refer to Product (in the Product.Name part) it's referring to the Product LookUp field on the Projectitem record. Then by adding the .Name it's using the name field of the Product record.
Again thanks for giving me the insight!
Best regards,
M.
Hi @MWierckx
ClearCollect(Selected_Product_Table, Projectitems.'Product (cbisa_Product)'.Name)
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Dear @yashag2255 ,
Thank you for your reply!
Unfortunately this isn't the solution, however it did help me find the right one - thinking about your comment on not having to use the LookUp function.
For filling the variable 'Productname' in a new collection I now do the following:
ForAll( Projectitems; Collect( Selected_Products_Table; { Productname: Product.Name } ) )
Because I'm doing this for the Projectitems entity (in the ForAll Function) when I refer to Product (in the Product.Name part) it's referring to the Product LookUp field on the Projectitem record. Then by adding the .Name it's using the name field of the Product record.
Again thanks for giving me the insight!
Best regards,
M.
Thanks for your posts and @MWierckx thanks for your solution.
This will be useful for others.
Best Regards.
Yumia
User | Count |
---|---|
26 | |
4 | |
4 | |
3 | |
2 |
User | Count |
---|---|
28 | |
10 | |
9 | |
9 | |
7 |