cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tdupton
Helper II
Helper II

DropDown Default Value

So..I know this must be something simple, but I can't figure it out.  I want to set the default selected value on an edit form for an employee. 

 

Dropdown items come from a SQL Azure table (dbo.Units which has 2 fields UnitID & UnitName).

Dropdown.Items = '[dbo].[Units]'

Dropdown.value=UnitName

Dropdown.default - LookUp('[dbo].[Units]',UnitID=ThisItem.UnitID,UnitName)

 

Why doesn't this select the right unit name?  It always returns the first unit in the table.

 

17 REPLIES 17

The datacard doesn't have a value property...the control does.  I listed that in the first post (it's set to unit table).  The dropdown is populating correctly with all units...the issue is I can't pass the UnitID from the Employee table and select the correct Unit in the Unit dropdown.

 

It has to be something simple that I'm missing...this is basic functionality.

Sienna
Memorable Member
Memorable Member

Yes you are right. Does your datasource Employee have UnitID column?

Yes.

First(Filter('[dbo].[Units]',UnitID=ThisItem.UnitID)).UnitName

Sienna
Memorable Member
Memorable Member

Ok.. try to change ThisItem for Datacard name... I’m not a fan of datacards but I believe this will work. Try to use intelisearch when typing. It should give you accesible option.

Same result.  Still just chooses first item in dropdown.

Sienna
Memorable Member
Memorable Member

Then I’m sorry. Like I said I’m not a fan of datacard. Maybe one more try
First(Filter('[dbo].[Units]',UnitID=First(Filter(EmployeeTable, UnitID=desiredUnitIDhere)).UnitID)).UnitName
timl
Super User III
Super User III

This sounds strange. My inclination is to use this syntax:

Lookup('[dbo].[Units]',UnitID=ThisItem.UnitID).UnitName


However, the formula that you wrote originally, and the formula beneath should equally work:

First(Filter('[dbo].[Units]',UnitID=ThisItem.UnitID)).UnitName


I suggest that you add a label to the same card and set the Text property to ThisItem.UnitID. When you do that, does the UnitID return the value that you expect for the record? To help diagnose this issue, I think it would be a good step to confirm that.

Thanks, everyone.  As it turns out, the UnitID value was returning blank.  After some troubleshooting, it was a weird error while converting from a SQL view to a table.  Nevertheless, my original syntax worked once I actually got data from the source.Smiley LOL

 

Sorry for the confusion.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (46,505)