Hi ,
I need some calculation logic in appain that gives difference of ration numbers example shown below in the screenshot.
Can someone help me to write the logic for this on priority?
Here actual and threshold values are user inputs based on those inputs variance col data to be shown .
Discussion posts and replies are publicly visible
You can create rule inputs for ratio1 and ratio2.
a!localVariables( local!ratio1: "3:1", local!ratio2: "2:1", local!ratio1Array: split(local!ratio1, ":"), local!ratio2Array: split(local!ratio2, ":"), local!lcm: lcm( local!ratio1Array[2], local!ratio2Array[2] ), concat( ( local!ratio1Array[1] * (local!lcm / local!ratio1Array[2]) ) - ( local!ratio2Array[1] * (local!lcm / local!ratio2Array[2]) ), "/", local!lcm ) )
now according to this formula-> (local!ratio1-local!ratio2)/local!ratio1*100 how would be in the change in tha code?
a!localVariables( local!ratio1: "3:4", local!ratio2: "5:6", local!ratio1Array: split(local!ratio1, ":"), local!ratio2Array: split(local!ratio2, ":"), local!lcm: lcm( local!ratio1Array[2], local!ratio2Array[2] ), local!numerator: ( local!ratio1Array[1] * (local!lcm / local!ratio1Array[2]) ) - ( local!ratio2Array[1] * (local!lcm / local!ratio2Array[2]) ), if( mod(local!numerator, local!lcm) = 0, local!numerator / local!lcm, concat(local!numerator, "/", local!lcm) ) )
Ok this code is giving difference of two numbers which is in ratios ,How to get the result by doing this calculation like the scenario difference of those numbers i.e (-1/12) and divided by local!ratio1 i.e 3:4 and multiply with 100.
So formula would be like this(local!ratio1(3:4)-local!ratio2(5:6)/local!ratio1(3:4)*100
I hole this makes more clear
a!localVariables( local!ratio1: "3:4", local!ratio2: "5:6", local!ratio1Array: split(local!ratio1, ":"), local!ratio2Array: split(local!ratio2, ":"), local!lcm: lcm( local!ratio1Array[2], local!ratio2Array[2] ), local!numerator: ( local!ratio1Array[1] * (local!lcm / local!ratio1Array[2]) ) - ( local!ratio2Array[1] * (local!lcm / local!ratio2Array[2]) ), local!result: if( mod(local!numerator, local!lcm) = 0, local!numerator / local!lcm, concat(local!numerator, "/", local!lcm) ), local!resultArray: split(local!result,"/"), local!lcm2: ((local!ratio1Array[2]*local!resultArray[1])/(local!ratio1Array[1]*a!defaultValue( value: index(local!resultArray,2,1), default: 1 ))), local!lcm2*100 )
Thank you so much
Now that it has worked for you, Can you please accept the answers to close this thread?
sure
I have one query related to the richtextdisplayfield.Could you please suggest?
a!richTextDisplayField( value: if( fv!item.finCov_txt = "Other", tointeger(fv!item.actualThreshold_txt) - tointeger(fv!item.covenentThreshold_txt), if( rule!CR_APP_DSC_displayFinCovPlaceholder( finCovType_txt: displayvalue( fv!item.finCov_txt, ri!crRefFinCov_cdt.finCov_txt, ri!crRefFinCov_cdt.valueType_txt, "" ) ) = "m:n", rule!CR_APP_FinCovCalculationmn( valueType1_txt: fv!item.actualThreshold_txt, valueType2_txt: fv!item.covenentThreshold_txt ), if( rule!CR_APP_DSC_displayFinCovPlaceholder( finCovType_txt: displayvalue( fv!item.finCov_txt, ri!crRefFinCov_cdt.finCov_txt, ri!crRefFinCov_cdt.valueType_txt, "" ) ) = "m:1", rule!CR_APP_FinCovCalculationm1( valueType1_txt: fv!item.actualThreshold_txt, valueType2_txt: fv!item.covenentThreshold_txt ), if( rule!CR_APP_DSC_displayFinCovPlaceholder( finCovType_txt: displayvalue( fv!item.finCov_txt, ri!crRefFinCov_cdt.finCov_txt, ri!crRefFinCov_cdt.valueType_txt, "" ) ) = "Amount", ( fv!item.actualThreshold_txt - fv!item.covenentThreshold_txt ) / fv!item.actualThreshold_txt * 100, if( rule!CR_APP_DSC_displayFinCovPlaceholder( finCovType_txt: displayvalue( fv!item.finCov_txt, ri!crRefFinCov_cdt.finCov_txt, ri!crRefFinCov_cdt.valueType_txt, "" ) ) = "Percentage", ( (fv!item.actualThreshold_txt / 100) - (fv!item.covenentThreshold_txt / 100) ) / (fv!item.actualThreshold_txt / 100) * 100, null ) ) ) ) ), style: if( fv!item.varience_txt > 0, "color: green;", if( fv!item.varience_txt < 0, "color: red;", {} ) ) ),
I have used richTextDisplayfield to write some colour logic.Since I would need green colour if the varience returns positive otherwise red .Since in 22.4.660.0 version doesn't have style parameter in richtextdisplayfield, How could I achieve this?
Hi
a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: { a!richTextIcon(icon: "USER", caption: "Name"), " Xavier Jones" }, size: "MEDIUM", style: { "STRONG" } ), char(10), char(10), a!richTextItem( text: { a!richTextIcon(icon: "BUILDING-O", caption: "Location"), " Reston, VA" }, color: "SECONDARY" ) } )
But I dont need icon in my case but that column has to be highlight, Can u modify above code which I have sent.
You cannot make any kind of highlight in the column level in 22V. Instead you can use a Tag Field to show your value with some color. Tag FieldI guess you should be able to make the change from the example given in the documentation.