web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invalid formula a valu...
Power Apps
Answered

Invalid formula a value with data source is expected

(0) ShareShare
ReportReport
Posted on by 163

HI

I am creating a stock and product management application. In a gallery I get a table with different IDs and not product and reference. I don't display the IDs but the name equivalent to the ID (via a lookup function).

With({_items:
 Search( 
 AddColumns(PRODUCT As _product; 
 "TAG_NAME"; LookUp(TAG; ID_TAG = _product.ID_TAG; TAG_NAME);
 "PROVIDER_NAME"; LookUp(PROVIDER; ID_PROVIDER=_product.ID_PROVIDER1; PROVIDER_NAME)
 );
 tdSearchinput.Text; "PRODUCT_NAME"; "TAG_NAME"; "PROVIDER_NAME";"MANUFACTURE"
 )};
 
 ForAll(Sequence(CountRows(_items));
 Patch(Last(FirstN(_items; Value)); {LineNumber: Value})
 )
)

This gallery takes me to a form that allows me to view product details.

Unfortunately in "ITEM" I have the following error

Invalid formula a value with data source is expected

 

Would someone please tell me why I'm making this mistake?

Capture.JPG

thanks for your help

 

Categories:
I have the same question (0)
  • LRVinNC Profile Picture
    2,297 on at

     What is the name of your gallery from which you are selecting the item to display?

     

    Here's a similar example where Gallery1 is displaying items from datasource PrepItem.  When the user selects an item, the form is displayed.

     

    Gal1.jpg

     

     

    Here's the form which specifies the same datasource, and then the galleryname and selected row with Gallery1.Selected.  Make sure your capitalization is correct on your gallery name.

    Gal2.jpg

     

  • tuonoman Profile Picture
    163 on at

    Hi @LRVinNC 

     

    Thanks for your help.

     

    if I understand your proposal put the same designation that is in the "item" of my gallery in the "datasource" of the form.

    the problem is that in the "item" of my gallery I have a formula.

    is this not a problem?

     

    tempsnip.png

  • LRVinNC Profile Picture
    2,297 on at

    No, the formula is absolutely fine for your gallery.  I just did a very simple example.  It's the Items for your form that will need <name of gallery>.Selected, such as Gallery1.Selected in my example.  The key is it is the name of the object (a gallery) from which you selected the item to show on the form, followed by .Selected to specify which item from the gallery to display.

  • tuonoman Profile Picture
    163 on at

    Hello @LRVinNC 

    Thank you for your help and example.
    But something I don't understand.
    You tell me that in the "DetailForm1" ITEM = LISTEPRODUCT.SELECTED and that DATASOURCE must be equal to ITEM of the gallery LISTEPRODUCT.
    In my case ITEM of LISTEPRODUCT is a formula. What should I put then?

     

    capt2.pngcapt1.png

  • Verified answer
    LRVinNC Profile Picture
    2,297 on at

    No, you don't need the With statement on your detail page.   That is only needed on the gallery. 

     

    Let's try this.  In Data Source, keep PRODUCT.  In Items, let's create a lookup to find the selected record.  I don't know the names of all your columns so you will need to find the right column names to use, but the format should be something like this...

     

    Lookup(PRODUCT, PRODUCT_NAME = LISTEPRODUCT.Selected.Label3.Text)  

     

    where Label3.Text is the correct name of the field in your LISTEPRODUCT gallery that displays the name of the product in your gallery and PRODUCT_NAME is the correct name of the column in PRODUCT containing the matching name.  

  • tuonoman Profile Picture
    163 on at

    @LRVinNC 

     

    Your solution works, thank you.

    The problem is that in the end I can only go back up the information that is in the gallery and not the details that don't appear in the gallery.

    Did I understand correctly

  • LRVinNC Profile Picture
    2,297 on at

    No, now that you have located the correct record via the lookup, you can access ANY column in that data source.  The columns do NOT have to be in the gallery.  You'll be able to add any of the PRODUCT columns to your form. 

    If you would please, be sure to mark the answer which helped you solve your problem as solution.  That will help close out the question in our system.

     

  • tuonoman Profile Picture
    163 on at

    HI@LRVinNC 

     

    Yes, it works great, but the information that I upload via the "ADD COLUMNS" and "lookup" functions does not come up.
    Any ideas?

     

    capt3.png

  • LRVinNC Profile Picture
    2,297 on at

    That's because Add Columns doesn't change your underlying data source.  So when you lookup the correct record for your detail screen it is only getting the Product record.  So you'll have to do one of two things:

    1.  Add the additional columns you want to use on the detail page again (which is not very efficient)

    2.  Save the augmented records in a collection, then work off the collection so that you have access to the entire set of columns you want to be able to use on both the summary and detail pages.  This is the more efficient option but will require some changes to operate off the collection.

  • tuonoman Profile Picture
    163 on at

     

    HI,@LRVinNC 

    I prefer solution 1 because I haven't been doing any special collections.
    I'm starting on powerapps in the case of solution 1, do you have an example?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard