Powerapps. We have a ForAll loop not iterating to create different records with Patch function.

Anonymous
2024-08-12T01:10:01+00:00

// The following code is not working. We are trying to iterate through the sessions, or the sessionids (neither works), and update the join table with a new entry for every different session (but the same person). It iterates the right number of times, but ThisRecord is not updating and is always the first record.

    ClearCollect(GroupSessions, Filter(Sessions, Group.GroupIdPk = _GroupEditing.GroupIdPk && Status = 'Status (Sessions)'.Active));

    ClearCollect(GroupSessionIds, ForAll(GroupSessions, SessionIdPk));

    // Concatenate the IDs using Concat function
    Set(concatenatedIDs, Concat(GroupSessionIds, Value & "; "));

    // Notify the concatenated result
    Notify("Concatenated IDs: " & concatenatedIDs, NotificationType.Information);

ForAll(
        groupSessionIds,
        Patch(
            JSessionParticipants,
            Defaults(JSessionParticipants),
            {
                Session: LookUp(groupSessions, SessionIdPk = ThisRecord.SessionIdPk),
                Person: _PersonAdding.Person
            }
        )
    );

    ForAll(
        groupSessionIds,
        RemoveIf(
            JSessionParticipants,
            Session.SessionIdPk = ThisRecord.Session.SessionIdPk && Person.PersonIdPk = _ParticipantDeleting.Person.PersonIdPk
        )
    );
Windows for business Windows Server Networking Network connectivity and file sharing

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-08-12T03:08:29+00:00

    Hello,

    Thank you for posting in Microsoft Community forum.

    Based on your description, this issue is beyond the scope of our support.

    To be able to get a quick and effective handling of your issue, I recommend that you repost your question in the Microsoft Power Platform Community, where there will be a dedicated engineer to give you a professional and effective reply.

    Here is the link for Community.

    Microsoft Power Platform Community Forum Thread

    Click the "Post a Question" button in the upper right corner to post your question and select tags related to your products.

    I hope the information above is helpful.

    If you have any questions or concerns, please feel free to let us know.

    

    Regards,

    Jill Zhou

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more