cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ale100
Frequent Visitor

Datacard is valid while blank

So i have a datacard that has a combobox with lookUp field(foreign key). I set the Lookup field with required in Sharepoint and add true to the required properties and it still ignore the validation. so i tried to see what is inside the datacard but i can't find the value of the record of Update. Should i simply make my own validation while the combobox is blank, i disable the submit button or use the submit form validation?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@ale100 

This is because the Valid property of the Datacard will be true if something is in the Update property.  You are providing a record for your Update property...thus it will not be blank - even if what is in it is blank.

 

Change your Update property to the following:

If(IsBlank(DataCardValue2.Selected), Blank(),
   {Id: DataCardValue2.Selected.ID,
    Value: DataCardValue2.Selected.Value //this should not be ID
   }
)

 Also, the Value of the Lookup column is usually based on a particular column from the foreign list.  You should not be providing ID for both of them.  Please review your lookup column definition to see what column value it wants.

 

Also, this can be highly simplified if your DataCardValue2 Items property is based on the Choices function on that Lookup column.  The Choices function will return a table with an Id and Value column from the foreign list that is all ready to use.  Then your Update property simply becomes : DataCardValue2.Selected  If nothing is selected, then the datacard (if required - which it is) will be invalid.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
KrishnaV
Super User
Super User

Hi @ale100 ,

 

Select the Datacard on the form and go to advanced properties of that and set the required property to True. You made the field required at datasource level, not at the form level which is what causing the issue for you.

Note: you will see this requred property at datacard level not at the combobox  level. so set this at datacard level.

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
ale100
Frequent Visitor

Hi @KrishnaV 

It is already in required, there even the star that show the field is required, but when i tried to submit, no error pop ups. If i complete the form with data, it will create the item without the foreign key.

formproblemdetailrequired.PNG

 

RandyHayes
Super User
Super User

@ale100 

This is because the Valid property of the Datacard will be true if something is in the Update property.  You are providing a record for your Update property...thus it will not be blank - even if what is in it is blank.

 

Change your Update property to the following:

If(IsBlank(DataCardValue2.Selected), Blank(),
   {Id: DataCardValue2.Selected.ID,
    Value: DataCardValue2.Selected.Value //this should not be ID
   }
)

 Also, the Value of the Lookup column is usually based on a particular column from the foreign list.  You should not be providing ID for both of them.  Please review your lookup column definition to see what column value it wants.

 

Also, this can be highly simplified if your DataCardValue2 Items property is based on the Choices function on that Lookup column.  The Choices function will return a table with an Id and Value column from the foreign list that is all ready to use.  Then your Update property simply becomes : DataCardValue2.Selected  If nothing is selected, then the datacard (if required - which it is) will be invalid.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

hi @RandyHayes !

I test something, It does give me true to this formula 

IsBlank(DataCardValue2.Selected)

Also for the value of the lookup, i can't really change this. because it refer the ID in a joint table that rely 2 lists. I know it can't do many-to-many-relationship, but i can't use sql or cds.i'll try to do a workaround with the few days lefts. 

RandyHayes
Super User
Super User

@ale100 

The update formula should give you what you need.  

As for the lookup - you are not changing anything about the column in your list, you are just needing to provide the proper values in your formula.  

If you look at the definition of the lookup column in your list, it will show "In this column:" and will show what the Value should be from.

The below shows a definition of a lookup and in this you can see that the lookup wants its Value to be the Title from the foreign list. 

So, to update this Lookup, I would provide the ID of the foreign record for the Id and the Title value for the Value.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

the definition of the lookup column where is that? all i have is the parameters of the column, but i get it, i shouldn't use the id like it did, in the lookup column. My issue is the ProblemDetailId, this lookup is the ID of a record where an horse and an injuries is. Could i done better yes, Can i do it now. not if i want to rework all my applicationsharepoint traitement.PNG

detailproblemesharepoint.PNG

Again if i knew how to do it way earlier i would. 

RandyHayes
Super User
Super User

@ale100 

Go into your list in SharePoint, then go to the List Settings for that list, then click on that lookup column in your list of columns.  It will then show you the definition for the column.

Looking at my prior post, it was supposed to have an image in it...not sure where it went.  

I will try again here below:

 

RandyHayes_0-1619043415391.png

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,982)