cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fnabeth
Regular Visitor

vlookup in power

Hello

 

 

I create an Power apps from Table1

 

Name    -   Date           -   Status  -    department

Franck   -    17-March   -   Sick    -    

Franck   -     18 March  -  Home

John      -     18 March  -  Office

....

 

In another table2 in the same excel I have this follow information

Name     -  department

Franck   -     Planning

John     -      Finance

 

 

the question is how when the user enter a new row with is name -date and status - How I can automatically enter the department 

using Table2 and I suppose Vlookup or something similar as in Excel

 

thanks

 

I am only few days in Power apps.

 

thanks

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

OK @Fnabeth ,

The Name and Group controls will be called something like TextInputxx with xx being a number.

I am calling them TextInput1 and TextInput3 below - you will need to change these to your names if incorrect. Also Table2  has been used as the name of your list and Department for the field.

On the Default of TextInput3 (Group)

Lookup(
   Table2,
   Name = TextInput1.Text,
   Department
)

On the OnChange of TextInput1 (Name)

Reset(TextInput3)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

OK @Fnabeth ,

A bit more new information - how is the employee name updated in the field?  I was assuming it was typed in therefore used the OnChange of the field to trigger the reset.

So if the Employee name is updated by User().FullName, you can try this. I will also use the name Form1 for your form.

Set a Variable on at App OnStart

Set(vUserName,User().FullName)

The Default of TextInput1

If(
   Form1.Mode= FormMode.New,
   vUserName,
   Parent.Default
)

The Default of TextInput3

If(
   Form1.Mode=FormMode.New,
   Lookup(
      Table2,
      Name = vUserName,
      Department
   ),
   Parent.Default
)

You would need the Name in Table2 spelt exactly as per the user's system name.

 

View solution in original post

8 REPLIES 8
WarrenBelz
Super User III
Super User III

Hi @Fnabeth ,

Firstly, Nameis not a good field "name" - you might consider changing this - however assuming the user is choosing from a dropdown, the syntax would be

Lookup(
   Table2,
   Name = YourControlName.Selected.xxxx,
   Name
)
   

where your control name is inserted and xxxx will be either .Value for a Choice or Lookup, .Result for a Distinct filter or .ActualFieldName (actual name) if filtered otherwise on a field.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

thanks

 

but where I need to copy this

Lookup(
   Table2,
   Name = YourControlName.Selected.xxxx,
   Name
)

I don't know

 

thanks again 

Ok @Fnabeth ,

Wherever the user is choosing their name. The example I gave was a combo/dropbox.

You would have to give me a screenshot of how you intend to do this (have the user enter/select their name).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Again thanks a lot

 

 

Attached the screen

 

again user just need to choose status, name (computer or mobile phone name) and date( today) are automatically done,  

and i would like , as  wrote, to get the in the group field , the department automatically.

 

the information should come from table2 - there I have the name and the departement

 

I hope I am clear enough. if You need more information let me know

 

thanks a lot 

 
 

OK @Fnabeth ,

The Name and Group controls will be called something like TextInputxx with xx being a number.

I am calling them TextInput1 and TextInput3 below - you will need to change these to your names if incorrect. Also Table2  has been used as the name of your list and Department for the field.

On the Default of TextInput3 (Group)

Lookup(
   Table2,
   Name = TextInput1.Text,
   Department
)

On the OnChange of TextInput1 (Name)

Reset(TextInput3)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Hello

you really helped me Warren

 

Just I need now to found how this working fine

 

In fact the employee name is by default the employee name of the user. but it's take time "few second" until it's update

 

and due to that the default of the group. isn't work properly.

 

only if I come back and edit again it, I see the group correctly updated.

if not it will be recorded empty

 

Do you you know how I can fix it?

OK @Fnabeth ,

A bit more new information - how is the employee name updated in the field?  I was assuming it was typed in therefore used the OnChange of the field to trigger the reset.

So if the Employee name is updated by User().FullName, you can try this. I will also use the name Form1 for your form.

Set a Variable on at App OnStart

Set(vUserName,User().FullName)

The Default of TextInput1

If(
   Form1.Mode= FormMode.New,
   vUserName,
   Parent.Default
)

The Default of TextInput3

If(
   Form1.Mode=FormMode.New,
   Lookup(
      Table2,
      Name = vUserName,
      Department
   ),
   Parent.Default
)

You would need the Name in Table2 spelt exactly as per the user's system name.

 

View solution in original post

Thanks a lot for your help

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!

Top Solution Authors
Top Kudoed Authors
Users online (97,188)