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

Lookup on SQL data table

I'm doing a training on Power apps using 2 sql tables.  The instructor had us create a data table and then do a lookup to that table.

Here is the formula I used.  

 

LookUp(
Agents,
AgentName = dcv_AgentName.Text,
AgentPhoneNumber
)

 

I get an error saying there is something wrong with the formula.

 

when I change it to the Agent Name, it returns the correct Name. (Formula showing correct data is below)

LookUp(
Agents,
AgentName = dcv_AgentName.Text,
AgentName
)

Does anyone know what I am doing wrong?

 

I have primary key's on the tables, but foreign key constraints are not setup.  Since it's working for the agentname, I don't understand why it's not working for the phone number.

See attachments

Thanks!

2 REPLIES 2
theapurva
Responsive Resident
Responsive Resident

 I suspect that AgentPhoneNumber is control,
please use the column name from Sql correctly.

If the sql column has space in it, please include in quote e.g. 'Agent Phone Number'

----------------------------------------------------------------------------------------------------------------------
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!
timl
Super User
Super User

@ashajohn2021 

I would attempt to use the alternate LookUp syntax that looks like this.

LookUp(
   Agents,
   AgentName = dcv_AgentName.Text
).AgentPhoneNumber

 

When you type the . after the closing bracket, the intellisense should more accurately show only the field names that are available.

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,395)