0

I am developing a program in Power Apps that allows users to self-select subscriptions from a Combo Box. In my system there are two SharePoint sheets:

The "Benutzerdaten" sheet, which contains:

  1. ID (Primary Key)
  2. UserID (defined by the code Office365-Benutzer.MyProfileV2().mailNickname)
  3. abo_id (foreign key linking the user to a subscription or subscriptions)

The "Abonnementen" sheet, which contains:

  1. ID (Primary Key)
  2. Titel (Subscription Title)

enter image description here

How can I organize the ComboBox and the "Accept" button so that the selected subscriptions are stored in the database taking into account the dependencies between tables?

When I write the corresponding code, I get the following error.

The type of this argument "abo_id" does not match the expected type "Table". Type "Number" was found.

In SharePoint the dependencies are set correctly and if I assign a subscription to a user in the "Benutzerdaten" sheet, it is assigned to him.

My code:

    ForAll(ComboBox_Abonnementen.SelectedItems;
        Patch(Benutzerdaten;
            Defaults(Benutzerdaten); {
                Titel: 'Office365-Benutzer'.MyProfileV2().mailNickname;
                abo_id: LookUp(Abonnementen; Titel = ThisRecord.Titel; ID)
            }
        )
    )

I have also tried the following code variations:

ForAll(
    ComboBox_Abonnementen.SelectedItems,
    Patch(
        Benutzerdaten,
        Defaults(Benutzerdaten),
        {
            UserID: 'Office365-Benutzer'.MyProfileV2().mailNickname,
            abo_id: Table({Value: LookUp(Abonnementen, Titel = ThisRecord.Titel, ID)})
        }
    )
)

And

ForAll(
    ComboBox_Abonnementen.SelectedItems,
    Patch(
        Benutzerdaten,
        Defaults(Benutzerdaten),
        {
            Titel: 'Office365-Benutzer'.MyProfileV2().mailNickname,
            abo_id: Table({Id: LookUp(Abonnementen, Titel = ThisRecord.Titel, ID)})
        }
    )
)

Thanks‌‌.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.