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

Set field value depending on selection from two other fields

In my app, dependent on a different selection above the cards, one of two cards will be displayed(ACHAccountCard or EFTAccountCard). For testing they are both visible right now.

Both cards have a dropdown "Account Type" field that retrieves names from a secondary list. Depending on the item they select, I retrieve the code that is used by SAP from a different column and store it in the form. 

ACHAccountCard Example:
ACHAcctType
DropDown items = Sort(Distinct(VendorDataList,AccountType),Result)

The ACHAcctCode field(Text) default =  LookUp(VendorDataList,AccountType = ACHAcctType.Selected.Result,AccountTypeCode)

EFTAccountCard dropdown is the same

EFTAcctCode = LookUp(VendorDataList,AccountType = EFTAcctType.Selected.Result,AccountTypeCode)

Both of these work to set their independent Code fields.

The issue is I have one "accttype" field that I want to be set depending on which of the two codes were set.

I have the accttype (text) field default =  If(ACHAcctCode.Text <> "-",ACHAcctCode,EFTAcctCode.Text <> "-",EFTAcctCode) but it never sets the value based on the EFTAcctCode, even if I leave the ACHAcctCode as the default ( "-") .

In the image below you can see that ACHAccttype is "-" and the EFTAcctType = "GL..... ", and the code retrieved is "GL" But the "accttype" field is "blank":

acctvalue.png

If I select a value for ACHAcctType, then it set the field correctly:

valuecorrect.png

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver II
Resolver II

After trial and error I rethought what I was doing and decided to use a variable I was already setting.

in the form above the cards, I have selection controls for the method of pay, which sets a variable (varmetpay):

methodpay.png

The selection will decide what card displays to enter the payment Information.

So, for my "accttype" field that stores the code selected that will be sent to SAP, I choose to set the default value = to "varmetpay" :

If(varmetpay = "T", ACHAcctCode,varmetpay = "E",EFTAcctCode). 

and the accttype field is updated based on which acctcode is set now 🙂 

View solution in original post

1 REPLY 1
Resolver II
Resolver II

After trial and error I rethought what I was doing and decided to use a variable I was already setting.

in the form above the cards, I have selection controls for the method of pay, which sets a variable (varmetpay):

methodpay.png

The selection will decide what card displays to enter the payment Information.

So, for my "accttype" field that stores the code selected that will be sent to SAP, I choose to set the default value = to "varmetpay" :

If(varmetpay = "T", ACHAcctCode,varmetpay = "E",EFTAcctCode). 

and the accttype field is updated based on which acctcode is set now 🙂 

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (51,979)