cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tushar18
Level: Powered On

Text Slicing in Fields of two CDS entities

I have 2 CDS Entities.
1. Items

2. Sales Order Lines
The primary lookup field of Items is ItemID. For Sales Order Lines it is ProductNumber.

Example of ItemID = A001,A002,AP110
Example of ProductNumber = A001:: ::240.0,A001:: ::48.0, AP110:: :: 32.0

So for 1 value in ItemID there are multiple lines in Sales Order Lines (with primary ID ProductNumber).

 

I want to get data from Sales order lines using ItemID to search in product number.

Is it possible or am I asking too Much.

 

Also I created relationship between entities if it helps. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-siky-msft
Microsoft

Re: Text Slicing in Fields of two CDS entities

Hi @Tushar18 ,

 

Sorry for my mistake.

It seems that that parameter does not support complex calls

We can use a variable to pass the ItemId you want. 

 

UpdateContext({VarItemid:First(Items).ItemID)})

Then set the following to Gallery's Items

Filter('Sales Order Lines',StartsWith(ProductNumber, VarItemid) )

Best regards,

Sik

 

 

View solution in original post

6 REPLIES 6
Microsoft v-siky-msft
Microsoft

Re: Text Slicing in Fields of two CDS entities

Hi @Tushar18 ,

 

Do you want to filter out all sales orders that the Product Number starts with ItemID?

You can use StartsWith function to get that, and use Filter funtion to get all data that satisfy that condition.

you can take the following formula for reference.

Filter('Sales Order Lines',StartsWith(ProductNumber, First(Items).ItemID) )

 

Best regards,

Sik

Tushar18
Level: Powered On

Re: Text Slicing in Fields of two CDS entities

Thank you so much for replying.

There is an error stating the function First() has invalid arguements.

Also these are both cds entities.

As you can see I can get InventTransSumFo as a suggestion but if I select it, it throws error.

Capture.PNG

Microsoft v-siky-msft
Microsoft

Re: Text Slicing in Fields of two CDS entities

Hi @Tushar18 ,

 

Could you share the error information?

Maybe you missed StartsWith function from my last post.

 

Best regards,

Sik

 

Tushar18
Level: Powered On

Re: Text Slicing in Fields of two CDS entities

Here's the whole formula and error message.

Capture.PNG

Microsoft v-siky-msft
Microsoft

Re: Text Slicing in Fields of two CDS entities

Hi @Tushar18 ,

 

Sorry for my mistake.

It seems that that parameter does not support complex calls

We can use a variable to pass the ItemId you want. 

 

UpdateContext({VarItemid:First(Items).ItemID)})

Then set the following to Gallery's Items

Filter('Sales Order Lines',StartsWith(ProductNumber, VarItemid) )

Best regards,

Sik

 

 

View solution in original post

Highlighted
Tushar18
Level: Powered On

Re: Text Slicing in Fields of two CDS entities

Thanks a lot.

It might sound stupid but where should I put the formula UpdateContext({VarItemid:First(Items).ItemId}) ?

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,088)