cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
patels11
Helper I
Helper I

Filtering Gallery with multiple type of inputs

Hello everyone,

my sharepoint site contains some line data as below snap.

patels11_1-1654236220011.png

 

my powerapp is a front where user can filter out lines based on first 5 criteria like PIDno, Unit no etc. when user write anythhing in marked area an click on True sign then it filters overall data and represent data based on filters. 

patels11_3-1654236286764.png

all first 5 column are simple text in sharepoint. in powerapp all these filters are single text entry. that means user can filter on 1055 sequence at a time. same for all filters.

this is what i want to achieve

1. i want to add checkbox type dropdown where user can check multiple items to filter. along with that out of this user should be able to filter even if only filter one row.

below is code i have applied to filter. 

patels11_4-1654236538899.png

 

2. current filter giving one error that after adding filter it shows dupplicates entry automatically out of nothing .

 

 

Thanks in Advance.

 

 

 

15 REPLIES 15
WarrenBelz
Super User
Super User

Hi @patels11 ,

Why are you using StartsWith AND equals on the same values ? You do not need the 5 items at the bottom as equals also StartsWith. You just need use Or at the top.

there are 2 reason for using startwith and equal at same time

1. when i am using  only startwith then it does not provide correct filtering. if system name is Y01,Y011 and when user type Y01 to filter it also filters Y011. 

2. when i am only using equals then suppose user filter system Y01 then it filters correctly but at a same time if user is not filtering other 4 rows so filter value is blank so even it is not filtering Y01 COLUMN. and showing no  data.

by using both it is filtering correct data.

 

but its not enough so i am expecting to provide chekcbox type dropdown or combobox where user can select multiple item to filter.

 

@patels11 .

Sorry, totally confused with your logic - if you want Equals, do not bother with StartsWith as it is not what you want. If you want StartsWith, you do not need Equals as StartsWith will also work when the values equal. The below will cover both Equals and StartsWith

ClearCollect(
   colGridData,
   Filter(
      Tracking_Jubail,
      StartsWith(
         'PID No.',
         FilterPID.Text
      ) ||
      StartsWith(
         'Unit No.',
         Filterunit.Text
      ) ||
      StartsWith(
         'Sequence No.',
         Filtersequence.Text
      ) ||
      StartsWith(
         'Stress System',
         Filterstresstystem.Text
      ) ||
      StartsWith(
         'DAP/WAP',
         Filterwap.Text
      )
   )
)

NOTE - watch spelling here as I needed to OCR your picture - please remember to post your code in Text also.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

okay. understood. 

now here "pid no" text lable only allow to write 1 pid no to filter. so  instead of 'PId no'.text lable i have replaced Combobox which lists all PID nu. (by distinct (datasourcename,PIdno)). what it allows too choose multiple unit nu. now in filter what should be syntax to accomodate this .

 

patels11_0-1654252612130.png

patels11_1-1654252750953.png

 

Code :

ClearCollect(
colGridData,
Filter(Tracking_Jubail,
StartsWith('PID No.',FilterPID.Text)||
StartsWith('Unit No.',Filterunit.Text)||
StartsWith('Sequence No.',Filtersequence.Text)||
StartsWith('Stress System',Filterstresstsytem.Text)||
StartsWith('DAP/WAP',Filterwap.Text)
//('PID No.'=ComboBox3.Selected.Result),
//('PID No.'= FilterPID.Text)Or
////('Unit No.'=Filterunit.Text)Or
//('Sequence No.'=Filtersequence.Text)Or
//('Stress System'=Filterstresstsytem.Text)Or
//('DAP/WAP'=Filterwap.Text)

)
);

@patels11 ,

If you have numeric fields, you can only use equals and you need to convert the output to a number, so

'PID No.' = Value(ComboBox3.Selected.Result)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

it is mixture of number and characters like 2001A. so i used  and it worked but  showing some glitch. after filtering with 2 values its shows 100's of duplicate entries which are actually not there in dataset.

'PID No.' =(ComboBox3.Selected.Result)

patels11_0-1654255308173.png

 

any possible reason for this ?

@patels11 ,

I would have to see your exact code to comment - can you please post this in Text.

ClearCollect(
    colGridData,
    Filter(Tracking_Jubail,
        //StartsWith('PID No.',FilterPID.Text)||
        //StartsWith('Unit No.',Filterunit.Text)||
        ////StartsWith('Sequence No.',Filtersequence.Text)||
        //StartsWith('Stress System',Filterstresstsytem.Text)||
        //StartsWith('DAP/WAP',Filterwap.Text)||
        'PID No.' = (ComboBox1.Selected.Result)
        //('PID No.'=ComboBox3.Selected.Result),
        //('PID No.'= FilterPID.Text)Or
        ////('Unit No.'=Filterunit.Text)Or
        //('Sequence No.'=Filtersequence.Text)Or
        //('Stress System'=Filterstresstsytem.Text)Or
        //('DAP/WAP'=Filterwap.Text)

    )
);
If(
    CountRows(colDataImport) > 0,
    Set(
        varNumber,
        varNumber + 1
    );
    ForAll(
        colDataImport,
        Collect(
            colGridData,
            Patch(
                varNewRecord,
                {
                    ID: varNumber,
                    'PID No.': First(ThisRecord.Value.Result).Result,
                    'Unit No.':Last(FirstN(ThisRecord.Value.Result,2).Result).Result,
                    'Sequence No.':Last(FirstN(ThisRecord.Value.Result,3).Result).Result,
                    'Stress System':Last(FirstN(ThisRecord.Value.Result,5).Result).Result,
                    'DAP/WAP':Last(FirstN(ThisRecord.Value.Result,4).Result).Result
                }
            )
        )
    )
);
Clear(colDataImport);

This code is under btnloaddata button. so after changing value in filter it runs. as on change property of each filter code is Select(btnloadData). i have tried to create new button btnloaddata_new and removed everything except filter function and assigned Select(btnloadData_new) to filters. stills same glitch. 

@patels11 ,

This is a completely different issue to what you initially posted - why are you using Patch inside a Collect function and what is colDataImport?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,040)