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

Expected Table value on Lookup using Sharepoint list data source

I'm rather new to PowerApps so please bear with me! 🙂

I'm making an Inward goods and package delivery tracker app and I until now have been using Lookup comfortably on my SharePoint data cards within an editform.

 

Currently, I can pick an address within my "Stores Daily Package Tracker" SharePoint list which has Lookup on the "ADDRESS/DEPT" column to a separate list called "Personnel List" which will grab the corresponding Area to fill in the defaultselecteditems of my Area datacard.

 

While the Area and Description/Notes boxes can be populated from lookups, my Address Field struggles with the Name field (all pulled from the same lists). It gives me the error "Expected Table Value". I have tried playing with the column types to try to negate this but it seems to be more within PowerApps.

 

For reference, my code is as follows:

 

Name Field OnChange property:

Set(varName,DataCardValue15.Selected.Value)

Name Field Items property:

Choices([@'Stores Daily Package Tracker'].NAME)

Address Field Items property:

Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT')

Address Field DefaultSelectedItems property (the one with the error):

LookUp('Personnel List',NAME=varName).ADDRESS

 

Screenshots attached. Any guidance here would be greatly appreciated!

RedZedNZ_0-1669950738328.png

RedZedNZ_1-1669951310696.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
EddieE
Super User
Super User

@RedZedNZ 

The error is because the DefaultSelectedItems must be a record from the table that is used for the Items property of the Address ComboBox. You are just using some TEXT and not a RECORD ... if that makes sense.

 

You could try:

// Address Field DefaultSelectedItems property
Lookup(
     Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT'),
     Value = LookUp('Personnel List',NAME=varName).ADDRESS
)

 

If that doesn't work, you could try setting another variable in the OnChange of the Name field, then the above would look like

 

// Name Field OnChange property
Set(varName,DataCardValue15.Selected.Value)
Set(varAddress,LookUp('Personnel List',NAME=varName).ADDRESS)

// Address Field DefaultSelectedItems property
Lookup(
     Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT'),
     Value = varAddress
)

 

 

View solution in original post

2 REPLIES 2
EddieE
Super User
Super User

@RedZedNZ 

The error is because the DefaultSelectedItems must be a record from the table that is used for the Items property of the Address ComboBox. You are just using some TEXT and not a RECORD ... if that makes sense.

 

You could try:

// Address Field DefaultSelectedItems property
Lookup(
     Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT'),
     Value = LookUp('Personnel List',NAME=varName).ADDRESS
)

 

If that doesn't work, you could try setting another variable in the OnChange of the Name field, then the above would look like

 

// Name Field OnChange property
Set(varName,DataCardValue15.Selected.Value)
Set(varAddress,LookUp('Personnel List',NAME=varName).ADDRESS)

// Address Field DefaultSelectedItems property
Lookup(
     Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT'),
     Value = varAddress
)

 

 

RedZedNZ
Frequent Visitor

@EddieE thank you so much for the explanation, the first code suggestion worked after I removed using variables in the lookup and instead just used the DataCardValue15.Selected.Value as the condition of the lookup instead:

LookUp(Choices([@'Stores Daily Package Tracker'].'ADDRESS/DEPT'), Value = LookUp('Personnel List',NAME = DataCardValue15.Selected.Value).ADDRESS)

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,526)