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

Access values from Collection

ForAll(
questionsCollection,
Patch(
'Survey Answers',
{

Question: ,
Wave: labelHiddenWave.Text,
'Key Process': labelHiddenKeyProcess.Text,
'Group Category': labelHiddenGroupName.Text,
'Customer Id': labelHiddenCustomerId.Text,
'Question Id': labelSurveyQuestionNumber.Text,
Responsible: Text(radioSurveyResponsible.SelectedText.Value),
SurveyStatus: Text(radioSurveyStatus.SelectedText.Value),
Name: Concatenate(
Text(comboBoxCustomer.Selected.'Customer Id'),
"-",
Text(comboBoxTimePeriod.Selected.Name)
),
'Unique Question Identifier': labelSurveyQuestionUniqueIdentifier.Text
}
)
);

Above is the code where questionsColelction contains all data, now needs to access values from questionsCollection and have to save it in Survey Answers

1 REPLY 1
Super User II
Super User II

Hi @anubhav29 

If I understand correctly, you have a collection of new data that you want to add to a target datasource.  If this is the case, you can simply use the Collect function to merge the collection with the datasource.

 

Collect(TargetDataSource,SourceCollection)

 

The source collection will need to have the exact same column names as the datasource it is to be merged with.  However, the order of the columns does not need to be the identical.  This can be accomplished by reshaping the collection using the AddColumns(), DropColumns(), RenameColumns() and ShowColumns() functions https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping  on the collection until it exactly matches the target datasource. 

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Users online (58,432)