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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help with validating t...
Power Apps
Answered

Help with validating two dataverse tables

(0) ShareShare
ReportReport
Posted on by 198

So I have two tables - "Employees" and Employee/Machine Links
And I have a column in the Employees table that is Active/Inactive and a column that connects the ID of the Employees column to the Employee/Machine Links table. I want to do a validation If I find the ID of the Employees column in the Employee/Machine Links table, I cannot inactivate the employee in the Employees table.

 

 

 

 

 

 

 

Funcionarios.png
Captura de tela 2024-03-22 101416.png
vinculo.png
Categories:
I have the same question (0)
  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @Pizzolati to check if the ID of the Employees column is in the Employee/Machine Links table Iwould do somthing like this:

     

     

     

    If(CountRows(Filter(YourEmployee/MachineTable,EmployeesInMachineID = EmployeesID)) > 0,true,false)

     

     

     You would then in the 'true false' add code to either prevent or enable them making the change.

     

    Hope this helps

     

    Please click Accept as solution if my post helped you solve your issue. ✔️ This will help others find the solution to this problem. It also closes the item. Remember, you can accept more than one post as a solution.

    If the content was useful in other ways, please consider giving it Thumbs Up. 👍

    Thanks
    Andrew

  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @Pizzolati - in addition to @AndrewR1 's suggestion, two questions:

     

    1. Are you using a Canvas App or a Model Driven App?
    2. Are the two columns actually related via LookUp column? If yes, I assume the relationship cardinality is one-to-many / many-to-one?

     

     

  • Pizzolati Profile Picture
    198 on at

    is a canvas App, and the relationship of the columns (Employee to Employee/Machine Links) is one-to-many.

  • Pizzolati Profile Picture
    198 on at

    I'll try and get back to you

  • Pizzolati Profile Picture
    198 on at

    The following error is occurring:

    Incompatible types for comparison. These types cannot be compared: Record, Text

     

    Formula:

    If(CountRows(Filter('Vínculos Funcionário/Máquina';'ID- Funcionario' = 'GalleryTodosFuncionariosAtivos'.Selected.ID)) > 0;true;false)
  • Verified answer
    Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @Pizzolati -

     

    You have provided little context or detail. Based on the images and descriptions you have provided, I am not clear on what you're trying to do.

     

    As I understand it, you have two Dataverse tables, "Employee" and "Employee/Machine Links". There is a one-to-many relationship between both tables from Employee (one) to Employee/Machine Links (Many).

     

    The Primary Column in the Employee table is called "ID", and the related LookUp column in the "Employee and Employee/Machine Links" table is called "ID-Funcionario".

     

    You have a Gallery control. I assume the Gallery is linked to the Employee table.

     

    In the Gallery, I think you have embedded a Checkbox control. I assume the Default property of the Checkbox is bound to a "Yes/No" data type called "Active". I am assuming the code you have used is:

     

    ThisItem.Ativo

     

    What I think you're trying to do

     

    If you want to disable the Checkbox if the ID column in the "Employee" table exists in the "Employee and Employee/Machine Links", you can apply the below to the DisplayMode property of the Checkbox control:

     

    If (
     IsBlank(
     LookUp(
     'Vínculos Funcionário/Máquina',
     'ID- Funcionario'.ID = ThisItem.ID
     )
     ),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

     

    If the above is not what you're trying to do, please provide further clarity.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 404

#2
timl Profile Picture

timl 344 Super User 2026 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

Last 30 days Overall leaderboard