cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RodzMaz81
New Member

How create my Variable

I would like to create a Variable that will return for me the division the site is from for example site Aeroton is a  Bakery(Division)

 

I already have a variable called varBranch that returns the site this information is in an external table called mas.branch and it returns the site with no issues using this function below

Set(
varBranch,
LookUp(
'[mas].[Branch]',
varBranchCode = POPCode,
POPName

)

);

 

 

However I have created another variable called varCategory/varDivision but still returns as blank maybe my function is incorrect may you assist please as the division or category is also found in the same table.My Function is as below

 

RodzMaz81_0-1629537413308.png

Set(

varDivision,

LookUp(
'[mas].[Branch]',
varBranch = Division,POPCode

)

);

3 REPLIES 3
PG_WorXz10
Community Champion
Community Champion

Hi @RodzMaz81 ,

Is this code added in your App on start ? Are you trying check the value after you added this code in App start ?

If so please run the Run on start as mentioned below to check the value of the variable. As in the Edit mode the app on start will only when you open the app after that if you add any code in the app start you have run app start explicitly. 

PG_WorXz10_0-1629538067842.png

 

 

 

 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.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

timl
Super User
Super User

@RodzMaz81 

I would double check the field names that you use in your call to LookUp.

For example, if you want to return the Division value from the first record from the [mas].[Branch] table where the POPCode value matches the value in varBranch, this is the syntax that you would use. Notice how you would pass Division as the third argument to LookUp .

 

Set(
    varDivision,
    LookUp(
          '[mas].[Branch]',
           varBranch = POPCode,
           Division
    )
);

 

I agree with @RodzMaz81 . Also check the variable type of varBranch.
If it's a record you can easily refer to varBranch.Division or varBranch.Category to get to other fields of that record.
That way you need less Lookup functions.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (2,585)