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 / Check if related recor...
Power Apps
Unanswered

Check if related record exists in another table

(0) ShareShare
ReportReport
Posted on by 820

Hi

I have 2 main tables in a dataverse. In table Components table I store my equipment. In table Transactions i register what was done with that equipment. 

I have a custom page model driven app where i select a Project name and it lists me in a gallery all equipment that is associated with this Project. Then i select with check boxes gallery items and select a certain task to be done for that equipment lets say Painting.

When i hit Submit button it patches a records of selected gallery items in Transactions table and also patches this specific task as Painting for each record. 

I want to make some security so that user does not register same item twice for same task. For example if user selects some items in a gallery and selects task to be registered(or vice versa) the gallery checkbox is unselected and disabled or gallery items changes color to red or gallery items just do not load if record already exist. Anything would help for beginning

Can you please suggest how to do that?

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Why don't you do a LookUp?

    Imagine that the field that stays the same and sets the connection is the id.

     

    You can do something like:

    If( IsEmpty(LookUp(DataSource, TaskID = ThisItem.TaskID)), PATCH, Notify("Task already submitted"))

     

    Something like that 

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • julijazas Profile Picture
    820 on at

    Hi @Nogueira1306 

    OK. I want to check if it works so i created a label in gallery and put formula for simple checking

    If(IsEmpty(LookUp(transactions,'equipment lookup'=ThisItem.name)),"Not present","Present")

    But i get error: incompatable types of comparison. These types can't be compared: Record, Guid

    'equipment lookup' is a lookup field name in trasnactions table and name is a name of that equipment in equipment table

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    If(IsEmpty(LookUp(transactions,'equipment lookup'.name=ThisItem.name)),"Not present","Present")


    And like that?

  • julijazas Profile Picture
    820 on at

    hi @Nogueira1306 

    it returns that all  are present thow i have entered only 1 item into transactions table

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    If LookUp is empty it should say that it is not present because you did not find anythin.g So, try this:

     

    If(IsEmpty(LookUp(transactions,'equipment lookup'.name=ThisItem.name)),"present","Not Present")

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • julijazas Profile Picture
    820 on at

    it says now not present for both records thow 1 record should be marked as present

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Are you sure that the lookup is correct? 

    You can try with IsBlank instead of IsEmpty

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website! 

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard