web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / unrelate a one-to-many...
Power Apps
Unanswered

unrelate a one-to-many relation

(0) ShareShare
ReportReport
Posted on by

Hi Folks,

i am currently building an app with a simple one-to-many relation. Lets asume I have an Item and ItemApprovers.

One Item Approver can have multiple Items to Approve. So Approvers to Items is one-to-many and therefore items to approvers is many-to-one.

In my App I have an ItemGallery and a Approver Assignmant Page. On the ItemGallery i want to unrelate the approver of the item. 

I couldn't get this to work. 

 

I can relate the item by 

Patch(Items, ItemGallery.Selected, {Approvers:First(Approvers)})

 

but unrelate by

Patch(Items, ItemGallery.Selected, {Approvers:blank()})

doesn't work. 

Also I can't get unrelate() to work. I tried all combinations, but no luck. If I don't get the error that I don't have a table, I'll get the it must be a to-many relation. 

 

Can somebody help me?

Categories:
I have the same question (0)
  • GarethPrisk Profile Picture
    2,828 on at

    Setting lookups (N:1) to a null/blank value is a tricky thing, right now.

    If you enable the advanced setting for formulas, then it will work.

     

    However, Unrelate does work in most cases. Can you post your formula to see if its a syntax issue?

  • criedelGer Profile Picture
    2 on at

    Hi, it's me. For some reason I had to choose a new username.
    Could you please tell me where exactly I can active the settings you mentioned? Is it in the app unde File->Settings->Advanced Settings-> Enhanced Formular bar?

    I activated this, but the patch formula still doesn't work.

     

    for unrelate I am currently with this formular

    Unrelate(ItemGallery.Selected.Approvers, ThisItem)
    Where in my understanding ItemGallery.Selected.Approvers  reflects to Entity1RelatedTable and Thisitem reflects to the record to remove from the table.
     
    But with this I got the error: "The first argument of Relate or Unrelate must refer to a 'to-many' relationship
     
    Any Idea?
  • MW Profile Picture
    Microsoft Employee on at

    3 years later and I ran into the same issue. Thank you for posting the complete error message. This will hopefully help others to find this also.

    if this is how you patch the item:
             Patch(Items, ItemGallery.Selected, {Approvers:First(Approvers)})

     

    then, instead of:

          Unrelate(ItemGallery.Selected.Approvers, ThisItem)

     

    you need to use:

           Unrelate(<Name of your Approvers Gallery>.Selected.Items, ItemGallery.Selected)

    This way you will "unpatch" your initial patch

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard