cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wilder1626
Helper II
Helper II

PowerApps - Search button that query in a table based on 4 TextInput boxes

Hi everyone. I'm just starting to build my first PowerApps application, so I'm a newbie.

I'm connected to an Oracle table with a connector, and that works as it pull the data in a Data Table (DataTable1) using:

Search('[Customer_t]',CustCode.Text,"Customer")

Now i want to create a search command that will search if any records exist in that table based on 4 TextInput (Textbox) values. If i have a match, it would feed the DataTable1.

I'm searching since this yesterday but can't seem to find.
I've tried so many thing but now, i'm guessing i should use a ShowColumns...:

ShowColumns('[Customer_t]')


Do i need to put the code in the search icon? If so, how will it feed the table? What do i need to do exactly?
SearchSearch

 

 

Thank you for your help and guidance.

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

@Wilder1626 

I had a similar issue in designing my app.  This was the solution.  In the OnStart of my app,  It used a single table (sales) and had  columns for Country, Region, 'Sales Channel', and 'Item Type'.  I made collections with a Collect() to add a blank value to each variable and then added the unique names for each column to the collections.  I then used these variables as the Items property of each dropdown.  There was also a TextInput box for the user to enter the numbers that the orderID started with.

 

 

Collect(
    cntry,
    {Result: Blank()}
);
Collect(
    cntry,
    Sort(
        Distinct(
            sales,
            Country
        ),
        Result
    )
);
Collect(
    itms,
    {Result: Blank()}
);
Collect(
    itms,
    Sort(
        Distinct(
            sales,
            'Item Type'
        ),
        Result
    )
);
Collect(
    regn,
    {Result: Blank()}
);
Collect(
    regn,
    Sort(
        Distinct(
            sales,
            Region
        ),
        Result
    )
);
Collect(
    channel,
    {Result: Blank()}
);
Collect(
    channel,
    Sort(
        Distinct(
            sales,
            'Sales Channel'
        ),
        Result
    )
)

 

 

The Items property of the datatable (a gallery would work equally well)

 

 

Filter(
        sales,
        IsBlank(ddItemType.Selected.Result) || 'Item Type' = ddItemType.Selected.Result,
        IsBlank(ddCountry.Selected.Result) || Country = ddCountry.Selected.Result,
        IsBlank(ddSalesChannel.Selected.Result) || 'Sales Channel' = ddSalesChannel.Selected.Result,
        IsBlank(TextInput1.Text) || StartsWith(
            Text(
                'Order ID',
                "[$-en-US]#########"
            ),
            TextInput1.Text
        )
    )

 

 

 

 

  Capture.PNG 

In the example, I decided not to use region but I could have as well.  In your app, I would suggest using dropdowns instead of textinput boxes if possible.  In my app there is a textinput box for one of the fields so you can get an idea of how to set it up, but I have found that forcing users to make a selection from a defined group of choices is better than having them misspell items, add spaces etc. Then they blame you when the selection doesn't work.

View solution in original post

2 REPLIES 2
Drrickryp
Super User II
Super User II

@Wilder1626 

I had a similar issue in designing my app.  This was the solution.  In the OnStart of my app,  It used a single table (sales) and had  columns for Country, Region, 'Sales Channel', and 'Item Type'.  I made collections with a Collect() to add a blank value to each variable and then added the unique names for each column to the collections.  I then used these variables as the Items property of each dropdown.  There was also a TextInput box for the user to enter the numbers that the orderID started with.

 

 

Collect(
    cntry,
    {Result: Blank()}
);
Collect(
    cntry,
    Sort(
        Distinct(
            sales,
            Country
        ),
        Result
    )
);
Collect(
    itms,
    {Result: Blank()}
);
Collect(
    itms,
    Sort(
        Distinct(
            sales,
            'Item Type'
        ),
        Result
    )
);
Collect(
    regn,
    {Result: Blank()}
);
Collect(
    regn,
    Sort(
        Distinct(
            sales,
            Region
        ),
        Result
    )
);
Collect(
    channel,
    {Result: Blank()}
);
Collect(
    channel,
    Sort(
        Distinct(
            sales,
            'Sales Channel'
        ),
        Result
    )
)

 

 

The Items property of the datatable (a gallery would work equally well)

 

 

Filter(
        sales,
        IsBlank(ddItemType.Selected.Result) || 'Item Type' = ddItemType.Selected.Result,
        IsBlank(ddCountry.Selected.Result) || Country = ddCountry.Selected.Result,
        IsBlank(ddSalesChannel.Selected.Result) || 'Sales Channel' = ddSalesChannel.Selected.Result,
        IsBlank(TextInput1.Text) || StartsWith(
            Text(
                'Order ID',
                "[$-en-US]#########"
            ),
            TextInput1.Text
        )
    )

 

 

 

 

  Capture.PNG 

In the example, I decided not to use region but I could have as well.  In your app, I would suggest using dropdowns instead of textinput boxes if possible.  In my app there is a textinput box for one of the fields so you can get an idea of how to set it up, but I have found that forcing users to make a selection from a defined group of choices is better than having them misspell items, add spaces etc. Then they blame you when the selection doesn't work.

View solution in original post

Wilder1626
Helper II
Helper II

Thanks. I will digest all this new information that seems easy and difficult at the same time, and then try your solution in my application. Will keep you posted. 😊

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 (51,074)