cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Responsive Resident
Responsive Resident

Duplication in gallery Items

HI all experts

 

Im stuck here in this major situation where i  need to see my gallery items only which has "Full Name" as that's the single record you can see in the image below but also want to show status but that's not single its repeated, is there a way to only update status only once? as this is updated when the flow runs behind, and when the approver approves this also updates all other records in the same Full name. which is the reason my gallery is looking like this. 

 

Do you have any solution or suggestion to this? 

Please see the screenshots below and formula

on Items property of Gallery: 

 

 

SortByColumns(
   Filter(
   'Petty Cash & GL Code',
   
   // here we are saying that the status variable must be "All",
   // which will then not filter any items, or else the status must match the variable
   StatusResult="All" || Status  = StatusResult & 'Full Name',
   
   // here we are saying, the textbox text is a blank or else it must
   // additionally filter the above by EmployeeName based on the Textbox Text
   SearchBox.Text = "" || StartsWith('Full Name', SearchBox.Text)  ),
"Title",
If(SortDescending1, Descending, Ascending) 
) 

 

 

ON Submit  button of Onselect event of Form: 

 

 

If(Value(DataCardValue26.Text) = 0,true, Notify("Weekly total value must be more then 0", NotificationType.Error););
Set(
    SelectedUnitName,
    'Edit_Unit Name_Input_1'.Selected.Value
);
ResetForm(Edit_Total_Form);

SubmitForm(WeeklyFrom_Edit);
Set(VarWeekTotal, DataCardValue26);

 

 

On Success of Submit Form: 

 

 

ResetForm(Edit_Total_Form); 
ResetForm(WeeklyFrom_Edit);

Navigate(Total_EditScreen); ResetForm(Edit_Total_Form); 

ForAll(
    Recordss,
    Patch(
        'Petty Cash & GL Code',
        Defaults('Petty Cash & GL Code'),
        {   
            Title: User().FullName,
            TripDescription: Trip,        
            Catering_HouseKeeping: Catering_HouseKeeping,
            Casual_Transport: Casual_Transport, 
            Equipment_Shortlife: Equipment_ShortLife,
            Programme_LifeSkills: Programme_LifeSkills,
            Cleaning_Household: Cleaning_Household,
            Medical_FirstAid: Medical_FirstAid,
            Heat: Heat,
            Bank_Charge: Bank_Charges,
            Sports: Sports,
            'Misc ': Postage,
            Total: Total,
            WeeklyTotal: WeeklyTotal,
            'Date  ': Datetime
        }
    )
) ;

 

 

Also please see the sharepoint image how does this looks and how gallery looks likeSharepoint ListSharepoint ListGalleryGallery

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Tapesh ,

Could you please share a bit more about your issue?

Could you please show more details about the "Status" column in your SP List? Is it a Choice type column or Text type column?

Further, do you want to filter your Gallery items when you press the different status buttons?

 

If the Status column is a Text type column in your SP List, and when you press the status buttons, you store the corresponding value into the StatusResult variable, I think the formula I provided above could achieve your needs. Please make sure the OnSelect property of these Status buttons to following:

"All" button:

Set(StatusResult, AllButton.Text)

"Pending" button:

Set(StatusResult, PendingButton.Text)

"Approved" button:

Set(StatusResult, ApprovedButton.Text)

....

Try the following formula:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),  // Add formula here
                      true,
                      Status  = StatusResult
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

Or you could also consider compare the Status column with different status value individually:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),  // Add formula here
                      true,
                      StatusResult = "Pending",
                      Status = "Pending",
                      StatusResult = "Approved",
                      Status = "Approve",
                      StatusResult = "Rejected",
                      Status = "Reject"
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

 

 

If the Status column is a Choice type column, please modify above formula as below:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),   // Add formula here
                      true,
                      Status.Value  = StatusResult     // Modify formula here
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

Please take a try with above solution, then check if the issue is solved.

Note: If you have saved the different status value into the StatusResult variable when you press the different "status" button, I think it is not necessary to compare the Status column with individual status value, instead, you could compare the Status column with the StatusResult variable.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support
Community Support

Hi @Tapesh ,

Which expected behavior do you want to achieve?

 

Firstly, based on the formula you typed within the Items property of the Gallery, I think there is something wrong with it. Please consider modify the formula within the Items property of the Gallery to following:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult="All",
                      true,
                      Status  = StatusResult
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

 

In addition, do you add a flow connection within your app to update the SP List Item? If you want the flow to only update one record within your SP List, you need to pass specific Item ID value to your flow from your app. Within your flow, you could update the SP List Item based on the passed Item ID value (using "Update Item" action of SP connector).

Note: The Item ID value is unique within your SP List, you should use it as Primary Key to update your existing List Item

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Responsive Resident
Responsive Resident

This is Perfect thanks @v-xida-msft , but just one thing instead of All, can i just provide condition, such as pending, approved and reject? is that possible with your condition ? is yes how as I'm getting the error when i tried to play with your code. 

Thanks

Hi @Tapesh ,

Could you please share a bit more about your issue?

Could you please show more details about the "Status" column in your SP List? Is it a Choice type column or Text type column?

Further, do you want to filter your Gallery items when you press the different status buttons?

 

If the Status column is a Text type column in your SP List, and when you press the status buttons, you store the corresponding value into the StatusResult variable, I think the formula I provided above could achieve your needs. Please make sure the OnSelect property of these Status buttons to following:

"All" button:

Set(StatusResult, AllButton.Text)

"Pending" button:

Set(StatusResult, PendingButton.Text)

"Approved" button:

Set(StatusResult, ApprovedButton.Text)

....

Try the following formula:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),  // Add formula here
                      true,
                      Status  = StatusResult
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

Or you could also consider compare the Status column with different status value individually:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),  // Add formula here
                      true,
                      StatusResult = "Pending",
                      Status = "Pending",
                      StatusResult = "Approved",
                      Status = "Approve",
                      StatusResult = "Rejected",
                      Status = "Reject"
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

 

 

If the Status column is a Choice type column, please modify above formula as below:

SortByColumns(
          Filter(
                 'Petty Cash & GL Code',
                  If(
                      StatusResult = "All" || IsBlank(StatusResult),   // Add formula here
                      true,
                      Status.Value  = StatusResult     // Modify formula here
                  ),
                  If(
                     SearchBox.Text = "" || IsBlank(SearchBox.Text),
                     !IsBlank('Full Name'),
                     StartsWith('Full Name', SearchBox.Text)
                  )
          ),
          "Title",
          If(SortDescending1, Descending, Ascending) 
) 

Please take a try with above solution, then check if the issue is solved.

Note: If you have saved the different status value into the StatusResult variable when you press the different "status" button, I think it is not necessary to compare the Status column with individual status value, instead, you could compare the Status column with the StatusResult variable.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Responsive Resident
Responsive Resident

This is more then i expected, thank you so much for the help @v-xida-msft , Amazing person you are.

Thanks 🤗

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

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