Skip to main content
December 1, 2021
Solved

show when while using decision for a drop down field

  • December 1, 2021
  • 7 replies
  • 0 views

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

    Best answer by stewart.burchell

    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
    December 1, 2021

    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
    December 2, 2021

    thank you for the information

    December 1, 2021

     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()
          )
          }
          )

    December 2, 2021

    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

    December 2, 2021

    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()
          )
          }