cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Manoj-VNBB
Frequent Visitor

Text input showing blank in gallery at bottom

Hello All, 

 

I have a gallery control for data editing. There are 2 controls inside the gallery TextInput1 & TextInput2. I have 100+ records in the gallery. On click of a button, I created a collection as below code and passed the collection to PowerAutomate. If I do not scroll down and clicks the button, last 50+ rows data is not caching the collection. But when I scroll once till the end of gallery, its working fine. Can anyone help what is the issue?

 

ForAll(Gallery1.AllItems,

    Collect(TestCollection,

        {

            Item1: TextInput1.Text,

            Item1: TextInput2.Text

        }

    )

)  

 

Thanks In Adavance

Manoj

6 REPLIES 6
mdevaney
Super User III
Super User III

@Manoj-VNBB 
A gallery control 'streams' data and only downloads 100 records at-a-time.  It does not download all 100+ records when the app opens.  That's why you must scroll to the bottom of the gallery.

 

Instead, you could download the datasource as a collection, patch the downloaded collection with changes from the gallery, and then upload the collection back to the datasource.  This would ensure all rows are uploaded.

 

 

---
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."

Hi @mdevaney ,

 

I am following the same as you said. I have custom connector as a back end. So I used to call the API and collect the data in a collection and set that collection as Gallery Data source. Again update a new collection from gallery and pass that to Power Automate. 

But still facing the same issue. 

 

Thanks

Manoj

@Manoj-VNBB 

Don’t update a new collection from the gallery.  Instead, update the old one.  That way you have all the rows 🙂

 

---
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."

Hi @mdevaney ,

 

I did that but for last 50+ records, TextInput1.Text & TextInput2.Text returns blank which make last 50 records blank for the collection. But it works and TextInput1.Text & TextInput2.Text returns proper data when I scroll down till the end. 

 

Thanks

Manoj 

@Manoj-VNBB 
Maybe you could write a condition inside your FORALL loop that says 'only patch the collection if the is not blank.  Otherwise do not. '.  That way your original question would retain its values and your upload will be successful.

 

---
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."

SkiDK
Solution Sage
Solution Sage

Hi @Manoj-VNBB 

You could use two collections. One for the local 'cache' data and one for the gallery. It does require an ID for each row though. But this way you'll avoid having to use a forall with the gallery items. Plus, this method is rather performant.

  1. Download the data into a collection. This will be your local cache, or your memory. "colData"
  2. Duplicate this collection in an exactly the same other collection. This one will serve as the backbone for the gallery, however the data of it will not be used to be shown in the gallery nor will any changes be made in this collection. "colBackBone"
  3. Link all fields to the local cache collection. We will show the data from the colData and if we change something, we will update colData. 

For Item1:

Default: 

LookUp(colData, ID = ThisItem.ID, Item1)

OnChange:

UpdateIf(
        colData,
        ID = ThisItem.ID,
        {
            Item1: TextInput1.Text
        }
    )

For Item2:

Default: 

 

LookUp(colData, ID = ThisItem.ID, Item2)

 

OnChange:

 

UpdateIf(
        colData,
        ID = ThisItem.ID,
        {
            Item2: TextInput2.Text
        }
    )

 

And so on and on ...

 This way of working is rather versatile, plus on every change the colData is immediately updates. This means that in the end you won't even need to collect AllItems from the gallery and you can send the colData straight to your flow. Your colData can be very large without data loss as you experience. Just use the colBackBone for gallery rendering and linking items with an ID, but nothing more.

It's just an alternative, but I hope this might help.

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.

Top Solution Authors
Top Kudoed Authors
Users online (34,470)