cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tuonoman
Helper IV
Helper IV

Multi formula in item gallery

Hi, 

 

I take the liberty of opening a new topic.

 

lately @timl and @WarrenBelz

 

my a lot of help in solving a problem.

 

But now a new question arises.How can I cumulate several formulas in a gallery item

 

for example, i have in my item this formula

 

 

AddColumns(PRODUCT; 
           "Tag_Name"; 
            LookUp(TAG;ID_TAG=PRODUCT[@ID_TAG]).TAG_NAME;
           "PROVIDER_NAME"; 
            LookUp(PROVIDER;ID_PROVIDER=PRODUCT[@ID_PROVIDER1]).PROVIDER_NAME
)

 

 

 I need to add this instruction

 

Search(PRODUCT;tdSearchinput.Text;"PRODUCT_NAME";"TAG_NAME";"PROVIDER_NAME")

 

thank you for your explanations

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User III
Super User III

@tuonoman 

You may combine those two sections of code like this.

 

 

Search(
    AddColumns(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"
)

 

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

timl
Super User III
Super User III

Hi @tuonoman 

I think you just have an extra semi-colon in your formula. If you try the following, that should hopefully remove your error.

Search(
    AddColumns(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"
)

 

 

View solution in original post

timl
Super User III
Super User III

Hi @tuonoman 

The search function takes three arguments - a source table (or data source), the search criteria, and the columns that you want to search.

In this example, the AddColumns function joins your 3 tables. The important thing here is that the return value from AddColumns is a data table with those three tables joined. You can then pass this return value as an input to the Search function.

This is the reason why AddColumns is nested inside Search. Does that make sense?

View solution in original post

11 REPLIES 11
mdevaney
Super User III
Super User III

@tuonoman 

You may combine those two sections of code like this.

 

 

Search(
    AddColumns(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"
)

 

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Hi @mdevaney 

 

I tested your proposal, unfortunately it doesn't work.

 

Any idea why?

 

thanks

How many rows of data are in your data sources and what is your data source (SharePoint, CDS, SQL)? You may be hitting a delegation issue (e.g. your Search cannot be processed on the server so PowerApps is pulling down the first X rows and searching them itself - X is the delegation limit which is normally set at 500 but can be increased to 2000 in the Advanced Settings - if the data you are searching for is outside the first X rows it won't be found).

Just a note that doing the LookUps inside the AddColumns is going to fire a separate network call for each LookUp for each row of your data which could be pretty horrible for performance if you have many rows.

@PaulD1 

 

At the moment I am in a learning phase.
I'm testing, learning, trying to get an opinion on PowerApps.

I am carrying out these tests on the basis of an Excel table stored on onedrive.
This table only contains a few lines.

I take note of your comments concerning the "lookups" function, do you have another proposal.

Maybe it would be smarter to make a table via Power Query and call this table in Powerapps.

The next step of my self-training would be to solve this problem. Table edition and the feedback of the information in my Excel tables. But that will be another Topic.

 

Thank you for your help.

@tuonoman 

No I don't know why unless you give me feedback about my solution. What do you mean by 'it doesn't work'? 

What about the code didn't work?  Errors?  No data?  Not the correct rows returned?  Please give details.

Hi @mdevaney 

 

Indeed if I don't give you more details it's not very cool of me.

 

the errors message are:

 

- The name is not valid. This indicator is not recognized.

 

- An operator was expected. We are expecting an operator such as +,*or & at this stage of the formula"

 

Independently, both functions work, but together they pose a problem.

 

Strange

 

Capture.PNG

timl
Super User III
Super User III

Hi @tuonoman 

I think you just have an extra semi-colon in your formula. If you try the following, that should hopefully remove your error.

Search(
    AddColumns(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"
)

 

 

View solution in original post

@timl , @mdevaney 

 

With the lynx's eye, it works!

That I understand. Why is it necessary to position the function add column in the search function?

 

Many thanks

timl
Super User III
Super User III

Hi @tuonoman 

The search function takes three arguments - a source table (or data source), the search criteria, and the columns that you want to search.

In this example, the AddColumns function joins your 3 tables. The important thing here is that the return value from AddColumns is a data table with those three tables joined. You can then pass this return value as an input to the Search function.

This is the reason why AddColumns is nested inside Search. Does that make sense?

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (46,955)