Skip to main content
Known Participant
Dec 1, 2021 10:34 AM UTC
Solved

show when while using decision for a drop down field

a!dropdownField(
label: "Type Of Loan",
labelPosition: "ABOVE",
choiceLabels: cons!LM_LoanTypes,
choiceValues: cons!LM_LoanTypes,
value: ri!LM_CustomerDetails.loanid.typeOfLoan,
saveInto: ri!LM_CustomerDetails.loanid.typeOfLoan,
searchDisplay: "AUTO",
required: true

a!floatingPointField(
label: "Interest Rate",
labelPosition: "ABOVE",
value: if(
ri!LM_CustomerDetails.loanid.typeOfLoan,rule!LM_LoanRates(LoanType: ri!LM_CustomerDetails.loanid.typeOfLoan )," " ),
saveInto: ri!LM_CustomerDetails.loanid.interestRate,
refreshAfter: "UNFOCUS",
readOnly: TRUE,

i want to display interest rate through the type of loan with decision i have created.but it is not displaying

    stewart.burchell
    Employee
    Dec 1, 2021 10:52 AM UTC

    There are a few things going on here:

    1. if you want the value of your floating point field to change when the user selects a value from the drop-down then you need to respond to that change in the dropdown component - that is, move the "saveInto" from the floating point component to the dropdown component. The key concept here is that a saveInto is only triggered when a user interacts with that component, so it won't be triggered in your floating point component (and never could be since you've marked it as "read only"
    2. User Interface components fall into three broad categories - input, output and structural. By using a floating point component (which is an input component) in read-only mode you're treating it as an "output" component and you should probably use al alternative. Especially as, in this example, an interest rate has a unit (which will be %) and should be quoted as such e.g. "1.5%" which would lead me to use a text field

    7 replies

    stewart.burchell
    Employee
    Dec 1, 2021 10:52 AM UTC

    There are a few things going on here:

    1. if you want the value of your floating point field to change when the user selects a value from the drop-down then you need to respond to that change in the dropdown component - that is, move the "saveInto" from the floating point component to the dropdown component. The key concept here is that a saveInto is only triggered when a user interacts with that component, so it won't be triggered in your floating point component (and never could be since you've marked it as "read only"
    2. User Interface components fall into three broad categories - input, output and structural. By using a floating point component (which is an input component) in read-only mode you're treating it as an "output" component and you should probably use al alternative. Especially as, in this example, an interest rate has a unit (which will be %) and should be quoted as such e.g. "1.5%" which would lead me to use a text field
    Known Participant
    Dec 2, 2021 4:59 AM UTC

    thank you for the information

    Inspiring
    Dec 1, 2021 11:02 AM UTC

     use this code as reference   

    a!localVariables(
      local!loanType,
      local!interestRate,
    {
    a!dropdownField(
      label: "Type Of Loan",
      labelPosition: "ABOVE",
      placeholder: "Select A Loan Type",
      choiceLabels: cons!TEST_LOANTYPES,
      choiceValues:cons!TEST_LOANTYPES,
      value: local!loanType,
      saveInto:{
        local!loanType,
        a!save(local!interestRate,rule!TEST_LoanRates(LoanType:local!loanType))
        
        },
      searchDisplay: "AUTO",
      required: true
      ),
    
      a!textField(
        label: "Interest Rate",
        labelPosition: "ABOVE",
        value:local!interestRate&"%",
          saveInto: local!interestRate,
          refreshAfter: "UNFOCUS",
          readOnly:true()
          )
          }
          )

    Known Participant
    Dec 2, 2021 5:17 AM UTC

    can i use it with rule inputs for saving the data.i need to capture the data for processmodel.and if i use rule inputs for the above code interest rate is not displaying

    Inspiring
    Dec 2, 2021 7:29 AM UTC

    even it should work with rule inputs 

    {
    a!dropdownField(
      label: "Type Of Loan",
      labelPosition: "ABOVE",
      placeholder: "Select A Loan Type",
      choiceLabels: cons!TEST_LOANTYPES,
      choiceValues:cons!TEST_LOANTYPES,
      value: ri!loanType,
      saveInto:{
        ri!loanType,
        a!save(ri!interestRate,rule!TEST_LoanRates(LoanType:ri!loanType))
        
        },
      searchDisplay: "AUTO",
      required: true
      ),
    
      a!textField(
        label: "Interest Rate",
        labelPosition: "ABOVE",
        value:ri!interestRate&"%",
          saveInto: ri!interestRate,
          refreshAfter: "UNFOCUS",
          readOnly:true()
          )
          }