cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimRohr
Level 10

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

And if you move User().Email to be a variable that you first set, then feed into your Set() statement in your lookup?

MitchC3
Level: Powered On

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

 

Set(UserEmail, User().Email); Set(CurrentUser, LookUp(Users, 'Primary Email' = UserEmail, User)); Set(UserToggle, true)

Another step in the right direction. Thank you for your persistance. This has removed all warnings, but not changed the return of the data set when unfiltered. I tried refreshing the Data Source of 'Accounts', deleting it and adding it again, and changing screens to trigger everything but no dice.

 

TimRohr
Level 10

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

Did you mean to say it isn't changing the returned data when it IS filtered? Because nothing in setting UserEmail or CurrentUser affects the unfiltered datasource. Your formula, if I have kept up with your changes, should now be:

SortByColumn(
    Search(
        If( UserToggle,                               // logical test
Filter(Accounts, Owner = CurrentUser), // true case, should filter to the CurrentUser
Accounts
),
TextSearchBox1.Text, "address1_city","name","address1_stateorprovince"
)
"name",
If(SortDescending1, Descending, Ascending)
)

Now that I'm thinking about it, I'm wondering if you are handling your UserToggle variable properly elsewhere. You initialize it to be true, but do you change it elsewhere? Do you have a control that modifies it? If you add a label to your screen and set its Text property to be UserToggle, does it show you true when you expect true and false when you expect false?

MitchC3
Level: Powered On

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

Sorry, what I meant was that the unfiltered data set (showing all Accounts) has not changed from when there was the delegation warning. There are still a select amount of Accounts returning and some not available to be searched. All warnings of delegation have dissappeared after assigning the two variables you suggested earlier.

 

The toggle is working properly. It is set in the formula I previously posted and has not changed. It is only changed through the OnChange property. I added a label and it returns true when only showing my Accounts and false when showing all Accounts as expected.

TimRohr
Level 10

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

One more suggestion, then...

 

Go back and look at @KroonOfficeSol's post where he suggested a Filter() with an OR construction.

SortByColumns( 
Search(
Filter(
Accounts,
!UserToggle.Value || Owner = CurrentUser
),
TextSearchBox1.Text, "address1_city","name","address1_stateorprovince" ), "name", If(SortDescending1, Descending, Ascending) )

That would remove the If() completely with a clever trick of handling the UserToggle.

 

If that doesn't work, I might be out of suggestions, but post back. Maybe something you encounter will spawn another thought. Good luck!

MitchC3
Level: Powered On

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

This works, just take the .Value off UserToggle!

MitchC3
Level: Powered On

Re: New Item property caused error: Invalid formula, expected a value compatible with DataSource

Thank you so much for all your help! This works with just a little tweaking. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 89 members 4,377 guests
Please welcome our newest community members: