RE: Difference of two ratio numbers

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

Parents Reply Children
  • 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?

  • 0
    Certified Associate Developer
    in reply to JS0001

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

    You need to try this way within the value field you can give the richtextItem

  • But I dont need icon in my case but that column has to be highlight,  Can u modify above code which I have sent.

  • 0
    Certified Senior Developer
    in reply to JS0001

    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 Field

    I guess you should be able to make the change from the example given in the documentation.