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

Only allow users enter text that exist in another data source?

Hello,

I have two SharePoint lists, Account Request 1 and Account Request 2. 

The Account Request 2 SharePoint list has  a field named Companylookup that contains all the company names. (Apple, Google, Amazon, etc.... ) 

On the Account Request 1 SharePoint list I have a field named Company. I want users to type in the company name on this field that only exists on the Companylookup field from Account Request 2 or else throws an error message. Could you please show me how I can accomplish this using PowerApps form? 

 

Thank you.

AP

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @apham :

Please try----

Set the textinput control's OnChange property to:

If(
    IsBlank(
        Lookup(
             'Account Request 2',
             Companylookup=Value(Self.Text)
        )
     ),
    Reset(Self);Notify("value must exist from the list below")
)

 Best Regards,

 Bof

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @apham :

Could you please tell me what Companylookup field is?Is it a text filed?

I assume Companylookup field is a Text filed.Please try:

Set the textinput control of "Company" field's OnChange property to:

 

If(IsBlank(Lookup('Account Request 2',Companylookup=Self.Text)),Notify("Error Message"))

 

Best Regards,

Bof

apham
Frequent Visitor

Bof, I'm sorry, the Companylookup field is number field. 

Thanks. 

apham
Frequent Visitor

I took a different approach. I created a combobox in the Company Datacard

 

apham_8-1622140228336.png

 

 

 

 

I set the Default property for Company text box 

If(Form6.Mode = FormMode.View, Parent.Default, Concat(ComboBox7.SelectedItems,(CompanyLookup)))

apham_6-1622140087852.png

 

I set the Items property for the ComboBox

apham_5-1622139935649.png

apham_9-1622140616055.png

 

 

Now, how do I prevent users from entering a value that does not exist from the dropdown list? I want to put a message like, "value must exist from the list below")  Thank you. 

 

apham_4-1622139736429.png

 

Hi @apham :

Please try----

Set the textinput control's OnChange property to:

If(
    IsBlank(
        Lookup(
             'Account Request 2',
             Companylookup=Value(Self.Text)
        )
     ),
    Reset(Self);Notify("value must exist from the list below")
)

 Best Regards,

 Bof

View solution in original post

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,410)