cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JonasH
Level: Powered On

Save data from Gallery in collection

Hey,
I want to save data from a gallery from outside the gallery.

Please see the picture on the right.2019-10-25 11_47_57-QC365 - Saved (Unpublished) - PowerApps.png

I want to save the Textinput and the number on the right (61, 62...).

To achive this I tried the following statement:

ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: Gallery2.AllItems.CheckOrderLineId,
        ActualData : Gallery2.AllItems.TextInput3
    }
)
);

But the data is stored not as I want.

Powerapps saved all Textinputs and numbers in every row.

 

 

2019-10-25 11_53_09-QC365 - Saved (Unpublished) - PowerApps.png

Thanks for your help

Jonas

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Save data from Gallery in collection

Hi @JonasH ,

Do you want to save your Gallery Items data into a collection?

 

Based on the formula you provided, I think there is something wrong with it. Please consider modify your formula as below:

Clear(tempCollection);   /* <-- Add this formula to get rid of duplicated records in this tempCollection */
ForAll(
Gallery2.AllItems, Collect( tempCollection, { CheckOrderLineId: ID, ActualData : TextInput3.Text } ) );

or

Clear(tempCollection); /* <-- Add this formula to get rid of duplicated records in this tempCollection */
ForAll( Gallery2.AllItems, Collect( tempCollection, { CheckOrderLineId: Value(IDLabel.Text), ActualData : TextInput3.Text } ) );

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

 

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

8 REPLIES 8
Super User
Super User

Re: Save data from Gallery in collection

@JonasH 

Looking at your code I can see you are saving the entire column to the collection.  The code Gallery2.AllItems.your_field saves a single column table.

 

ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: Gallery2.AllItems.CheckOrderLineId,
        ActualData : Gallery2.AllItems.TextInput3
    }
)
);

 

To save only the current item try this instead

 

ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: Gallery2[@CheckOrderLineId],
        ActualData : TextInput3.Text
    }
)
);

Let me know if there are any questions

 

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

 

JonasH
Level: Powered On

Re: Save data from Gallery in collection

Hey @mdevaney 

thanks for your help.

Meanwhile the "CheckOrderLineId" changed to "ID" but the adjusted code doesnt work.

ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: Gallery2[@ID],
        ActualData : TextInput3.Text
    }
)
);2019-10-25 16_41_32-Window.png

 

2019-10-25 16_40_56-Window.png

 

I may be to stupid momentarily, please excuse.

 

I will be able to reply in about 2 days

 

Have a nice weekend

Jonas

Super User
Super User

Re: Save data from Gallery in collection

@JonasH 

Before you go can you try these instead and let me know the result? I was trying to use Gallery2[@ID] in case Gallery2.AllItems and tempCollection both had an ID column.  Perhaps my snytax was wrong.

 

ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: Gallery2.ID,
        ActualData : TextInput3.Text
    }
)
);
ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        CheckOrderLineId: ID,
        ActualData : TextInput3.Text
    }
)
);
Community Support Team
Community Support Team

Re: Save data from Gallery in collection

Hi @JonasH ,

Do you want to save your Gallery Items data into a collection?

 

Based on the formula you provided, I think there is something wrong with it. Please consider modify your formula as below:

Clear(tempCollection);   /* <-- Add this formula to get rid of duplicated records in this tempCollection */
ForAll(
Gallery2.AllItems, Collect( tempCollection, { CheckOrderLineId: ID, ActualData : TextInput3.Text } ) );

or

Clear(tempCollection); /* <-- Add this formula to get rid of duplicated records in this tempCollection */
ForAll( Gallery2.AllItems, Collect( tempCollection, { CheckOrderLineId: Value(IDLabel.Text), ActualData : TextInput3.Text } ) );

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

 

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

JonasH
Level: Powered On

Re: Save data from Gallery in collection

@mdevaney@v-xida-msft 

Thanks for your helpfull replys.

Your solutions worked well.

I used the code below (dont be confused cause of other line names):

Clear(tempCollection);
ForAll(Gallery2.AllItems,
Collect(
    tempCollection,
    {
        ID: ID,
        measuredSize: Value(TextInput3.Text)
    }
)
);

My next step is to update the measuredSize to a SQL record with the correspond ID.

 

Thanks for your help.

 

Have a nice day ^-^

Jonas

JonasH
Level: Powered On

Re: Save data from Gallery in collection

@mdevaney@v-xida-msft 

I have another question.

To save the data in a collection was just a bypass of saving the data in an SQL table.

I thought it might be easier to save the data in a collection before updating a SQL table column with the specific ID.

Unfortunately it only work with a hardcoded ID.
Please take a look on the code below:

 

UpdateIf('[qc365].[W_InspectionTaskPosition]', ID = 87, {measuredSize: Value(TextInput3.Text)})

The best result is, to get the current ID of a Forall statement.

I also tried to get the data from the collection (remember the bypass).

 

Thanks for your help.

Jonas

Super User
Super User

Re: Save data from Gallery in collection

@JonasH 

You might want to close this thread and post as a new question so others will take a look.  I don't know the answer here.

JonasH
Level: Powered On

Re: Save data from Gallery in collection

@mdevaney Okay, I close this thread.

Have a nice day.

Helpful resources

Announcements
thirdimage

Power Platform 24

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,810)