cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LyonsBI_BRL
Resolver II
Resolver II

Append Item to Collection & Retrieve Value

I'm currently building out an App though I'm running into a bit of trouble here when I go to append to the collection, and then attempt to retrieve that value from the collection back into the form when I need to edit that item out again.

Below I have the participant ID and their score sheet

 

LyonsBI_BRL_0-1660209289525.png

 

I save to the collection using the code below.

 

Patch(
    colBRLScore,
    BRLScoreSheet.Selected,
    
    {
        EntryID:Value(DataCardValue15.Text),
        First_Name:DataCardValue22.Text,
        Last_Name:DataCardValue23.Text,
        Division:DataCardValue26.Text,
        B1_x0020_Scr:Value(DataCardValue32.Text),
        B1_x0020_T:Value(DataCardValue33.Text),
        B1_x0020_NS:DataCardValue34.Value,
        B1_x0020_3S:DataCardValue35.Value,
        B2_x0020_T:Value(DataCardValue7.Text),
        B2_x0020_Scr:Value(DataCardValue8.Text),
        B2_x0020_NS: DataCardValue9.Value,
        B2_x0020_3S: DataCardValue10.Value,
        DQ:DataCardValue14.Value,
        RSO: DataCardValue16.Value,
        Bay_x0020_1_x0020_Score:DataCardValue6.Text,
        Bay_x0020_2_x0020_Score:DataCardValue21.Text,
        B3PassFail:DataCardValue41.Selected.Result,
        B4PassFail:DataCardValue42.Selected.Result
                 
    });
Navigate(BRLScoreSheet)

 

However, after I move off that record and edit another record through that form and go back, the data for that record won't appear in the form. How do I manage to pull the users data back into the form from the collection when I go to edit it again? I have tried using this below for when I go to click on the Edit button within my gallery for a particular user, though it's not pulling the data from the collection

If(ThisItem.EntryID in colBRLScore.EntryID,
LookUp(colBRLScore,EntryID = ThisItem.EntryID),

    {
        EntryID: ThisItem.EntryID,
        First_Name: ShowFirstName.Text,
        Last_Name: ShowLastName.Text,
        Fire_x0020_Team: ShowFireTeam.Text,
        Division: ShowDivision.Text,
        B1_x0020_Scr: Bay1Score.Text,
        B1_x0020_T:Bay1Time.Text,
        B2_x0020_Scr:Bay2Score.Text,
        B2_x0020_T: Bay2Time.Text,
        B3PassFail:Bay3Challenge.SelectedText.Value,
        B4PassFail:Bay4Challenge.SelectedText.Value,
        Total: TotalScore.Text,
        Average_x0020_Time: AverageTime.Text,
        DQ: DQSelect.Value,
        Absent: Absent.Value

        });
Set(varEditThisParticipant, 
ThisItem);ResetForm('BRL  Participant');Navigate('BRL  Participant');Navigate('BRL - Bay 1')

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

LookUp(colBRLScore,EntryID = ThisItem.EntryID).B1_x0020_Scr

SOLVED it, had to use this as the Default and now show's correctly 🙂 

View solution in original post

4 REPLIES 4
RusselThomas
Microsoft
Microsoft

Hi @LyonsBI_BRL ,

Are you at some point patching the data back to the source?  

Forms connect to data sources - not to collections - so if you're only patching to the collection the Form will never see it...If you want the Form to see it, you would need to patch that data back to the source the Form is connecting to....

[Edit: unless you set your form controls Default: values to come from the collection fields instead of the source fields while it's still in New mode....haven't tried this, but if you're specifically wanting to pull the data back into the form before it's captured back to source, then this might work....]

Hope this helps,

RT

Looks like I've solved at least one bit here

LyonsBI_BRL_0-1660213729354.png

And within the default, I'm able to retrieve the data 

LookUp(colBRLScore,EntryID = ThisItem.EntryID).B1_x0020_Scr

 

Now I did try this same method for check boxes and drop downs, though I'm getting an error. Any suggestion on this part?

 

LyonsBI_BRL_1-1660213808467.png

 

RusselThomas
Microsoft
Microsoft

Try .Value for booleans?

....B1_x0020_T.Value

LookUp(colBRLScore,EntryID = ThisItem.EntryID).B1_x0020_Scr

SOLVED it, had to use this as the Default and now show's correctly 🙂 

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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,757)