calculation between Objects

can anyone Check If the following code is correct .The final output is not displaying in the required field. It is for calculating loan interest

a!formLayout(
contents: {
a!sectionLayout(
contents: {
a!columnsLayout(
columns: {

a!columnLayout(
contents: {
a!integerField(
label: "Amount Of Loan required",
labelPosition: "ABOVE",
value: ri!LM_CustomerDetails.loanid.amountOfLoanRequired,
saveInto: {
ri!LM_CustomerDetails.loanid.amountOfLoanRequired,
a!save(
ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
if(
and(
not(isNull(ri!LM_CustomerDetails.loanid.amountOfLoanRequired)),
not(isNull(ri!LM_CustomerDetails.loanid.interestRate)),
not(isNull(ri!LM_CustomerDetails.loanid.repaymentPeriod))
),
((ri!LM_CustomerDetails.loanid.amountOfLoanRequired * ri!LM_CustomerDetails.loanid.interestRate)/ri!LM_CustomerDetails.loanid.repaymentPeriod),
{}
)
)
},
refreshAfter: "KEYPRESS"
)
}
),
a!columnLayout(
contents: {
a!floatingPointField(
label: "interest rate",
labelPosition: "ABOVE",
value: ri!LM_CustomerDetails.loanid.interestRate,
saveInto: {
ri!LM_CustomerDetails.loanid.interestRate,
a!save(
ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
if(
and(
not(isNull(ri!LM_CustomerDetails.loanid.amountOfLoanRequired)),
not(isNull(ri!LM_CustomerDetails.loanid.interestRate)),
not(isNull(ri!LM_CustomerDetails.loanid.repaymentPeriod))
),
((ri!LM_CustomerDetails.loanid.amountOfLoanRequired * ri!LM_CustomerDetails.loanid.interestRate)/ri!LM_CustomerDetails.loanid.repaymentPeriod),
{}
)
)
},
refreshAfter: "KEYPRESS",
)
}
),
a!columnLayout(
contents: {
a!integerField(
label: "Repayment Period",
labelPosition: "ABOVE",
value: ri!LM_CustomerDetails.loanid.repaymentPeriod,
saveInto: {
ri!LM_CustomerDetails.loanid.repaymentPeriod,
a!save(
ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
if(
and(
not(isNull(ri!LM_CustomerDetails.loanid.amountOfLoanRequired)),
not(isNull(ri!LM_CustomerDetails.loanid.interestRate)),
not(isNull(ri!LM_CustomerDetails.loanid.repaymentPeriod))
),
((ri!LM_CustomerDetails.loanid.amountOfLoanRequired * ri!LM_CustomerDetails.loanid.interestRate)/ri!LM_CustomerDetails.loanid.repaymentPeriod),
{}
)
)
},
refreshAfter: "KEYPRESS"
)
}
),
a!columnLayout(
contents: {
a!integerField(
label: "Loan Repayment Per Month",
labelPosition: "ABOVE",
value: ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
saveInto: {
ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
a!save(
ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
save!value
)
},
refreshAfter: "UNFOCUS",
readonly: true()
)
}
)
}
)
}
)
}
)

  Discussion posts and replies are publicly visible

  • Hi, can you add a few additional details - are you noting that when you enter a value in the Loan Repayment Per Month field, the value is not saved into ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth data point?

    I do note that your saveInto is redundant for this "Loan Repayment Per Month" field - you have the value saving back into itself on line 90, then an a!save() which saves the same value into itself again on lines 91-94.  You can remove this before we troubleshoot further, adjust this field to be:

                    a!integerField(
                      label: "Loan Repayment Per Month",
                      labelPosition: "ABOVE",
                      value: ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
                      saveInto: ri!LM_CustomerDetails.loanid.loanRepaymentPerMonth,
                      refreshAfter: "UNFOCUS",
                      readonly: true()
                    )

    Also when posting code please note we have an INSERT -> CODE feature for readability: