I am having an issue using and setting variables in my app for User Onboarding. When a Job Title is selected, other parts of the app should be auto populated. I successfully accomplished this with one Job Title and one Auto-populated field (see below)
Formula / Setting Variables
15Five DefaultSelectedItems Property
A couple things go wrong when I make additions . . .
When I attempt to declare new variables (as I've done in the above successful attempt), I get the incompatible type error.
- Set Variable
Set variable on DataCardValue
Issue Details
1) What changes need to be made to auto-populate other fields based on a Job Title Selection?
2) Why does the "Incompatible Type Error" appear when I try to add other Job Titles to the Variable?
3) As I build more logic, does all of the variables need to be declared in the same place (new form / button formula)?
Solved! Go to Solution.
Thanks everyone for the responses and recommendations, we have solved the problem. There was a second variable declaration that was throwing the error. One of the columns I had listed was a question, "Drive Access Required?" and there were 5 options.
Ultimately, there were three properties that needed to be changed:
Sample Code Below
Form Screen 1 Entry
Set(varDriveAccessRequired,["A", "B", "C", "N", "X"]);
OnChange Property
Switch(DataCardValue19.Selected.Value,"A",
Set(varJobTitle,"Accounts Payable Specialist"),"B",
Set(varJobTitle,"Accountant II"),"C",
Set(varJobTitle,"Accounting Intern"),"X",
Set(varJobTitle,"Accounts Payable Specialist II"),"N")
DefaultSelectedItems Property
The incompatible type error occurs when the type of value stored in a SET variable is inconsistent across the app. Your SET variable can only be one of these types, not both
In your app you have varJobTitle
You could make the data types consistent by doing this.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Hey @mdevaney
Thanks for your reply.
When I hover over each Job title: ["Accounts Payable Specialist", "Accountant II"], each show as "Text" even though they are written in the "Record" syntax. How can I force my app to recognize this entry: ["Accounts Payable Specialist", "Accountant II"], as a record vs "text"?
If you hover over the entire ["Accounts Payable Specialist", "Accountant II"] it should recognize as a Table.
(Sorry I said record earlier but meant table)
HI @AutoSol ,
Based on the issue that you mentioned, I think you have faced Incompatible error with your formula. The varJobTitle variable you initialized before in your app is a Text value variable, but then you update this variable with a Table value, which is not Incompatible.
Note: You must update a variable with Incompatible value as initialized before.
In addition, the ["Accounts Payable Specialist", "Accountant II"] formula would be recognized as a Table value rather than record in PowerApps app.
Based on the needs that you mentioned, I think it is not necessary to set up variables to store the default value for other fields in your Edit form. On your side, you could consider populate other fields in your Edit form directly based on the selected value within the Job Title ComboBox.
I have made a test on my side, please consider take a try with the following workaround:
Set the DefaultSelectedItems property of 15Five Needed? ComboBox to following:
{
Value: If(
JobTitleComboBox.Selected.Value = "AccountsPayableSpecialist",
"Yes",
JobTitleComboBox.Selected.Value = "Accountant II",
"No"
)
}
or
{
Value: Switch(
JobTitleComboBox.Selected.Value,
"AccountsPayableSpecialist", "Yes",
"Accountant II","No"
)
}
Similar formula would be applied to other Choice field ComboBoxes within the Edit form.
Please consider take a try with above solution, check if the issue is solved.
Best regards,
Thanks everyone for the responses and recommendations, we have solved the problem. There was a second variable declaration that was throwing the error. One of the columns I had listed was a question, "Drive Access Required?" and there were 5 options.
Ultimately, there were three properties that needed to be changed:
Sample Code Below
Form Screen 1 Entry
Set(varDriveAccessRequired,["A", "B", "C", "N", "X"]);
OnChange Property
Switch(DataCardValue19.Selected.Value,"A",
Set(varJobTitle,"Accounts Payable Specialist"),"B",
Set(varJobTitle,"Accountant II"),"C",
Set(varJobTitle,"Accounting Intern"),"X",
Set(varJobTitle,"Accounts Payable Specialist II"),"N")
DefaultSelectedItems Property
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
183 | |
70 | |
43 | |
34 |
User | Count |
---|---|
338 | |
266 | |
116 | |
66 | |
66 |