Forum Discussion

WillVitale's avatar
WillVitale
Contributor
2 years ago

Amount and Annotation Confirmation Rule

Hello,

I'm trying to create a confirmation rule that looks if these two accounts have a difference of 10k USD or more and if so it looks to see if it has a comment (annotation) made by our user and if it doesn't it will fail. So far I got the first part to see if the value is over 10k, but checking it to see if there's a comment also is confusing me. 

args.ConfirmationRuleArgs.DisplayValue = math.Round(api.Data.GetDataCell("A#Bad_Debt_Comp:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD").cellAmount, 2)
If System.Math.Abs(args.ConfirmationRuleArgs.DisplayValue) > 10000  Then
args.ConfirmationRuleArgs.Info1 =  "Bad Debt USD = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#0319:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD").cellAmount, 0))
args.ConfirmationRuleArgs.Info2 =  "CCM Bad Debt USD = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#CCMBadDebt:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD.cellAmount, 0))	
'args.ConfirmationRuleArgs.Info3 =  "Out of BALANCE Check = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#BALANCE:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD").cellAmount, 0))

	Return True
Else
args.ConfirmationRuleArgs.Info1 =  "Bad Debt USD = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#0319:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD").cellAmount, 0))
args.ConfirmationRuleArgs.Info2 =  "CCM Bad Debt USD = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#CCMBadDebt:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD).cellAmount, 0))
'args.ConfirmationRuleArgs.Info3 =  "Out of BALANCE Check = " & String.Format("{0:#,##0}",math.Round(api.Data.GetDataCell("A#BALANCE:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#LOAD:F#TopFlow:O#Top:I#Top:C#USD").cellAmount, 0))

     Return False
End If

 

Would I just add another add an another section and say: 

args.ConfirmationRuleArgs.DisplayValue = api.Data.GetDataCell("A#0319:U1#Top1:U2#Top2:U3#Top3:U4#Top4:U5#Top5:U6#Top6:U7#USGAAP:F#TopFlow:O#Top:I#Top:C#USD:V#Annotation").cellAmount
If System.Math.Abs(args.ConfirmationRuleArgs.DisplayValue) = " " Then

 

I'm a bit new to writing confirmation rules, so this is a bit out of my wheel house. I did download a Confirmation Rules PPT from a 2016 OS Conference which was helpful, but still stuck. 

Thanks

Will

  • Hi WillVitale ,

    This will return the cell text Annotation - update with your respective POV:

    stringAnnot = api.Data.GetDataCellEx("Cb#GolfStream:E#" + WFEntity + ":C#USD:V#Annotation:A#Account:F#Flow:O#Forms:I#None:U1#None:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None").DataCellAnnotation

     

    You can then do 

    If ResultCellEx.DataCellAnnotation.Length < 1 Then

  • MikeG's avatar
    MikeG
    Contributor III

    Hi WillVitale ,

    This will return the cell text Annotation - update with your respective POV:

    stringAnnot = api.Data.GetDataCellEx("Cb#GolfStream:E#" + WFEntity + ":C#USD:V#Annotation:A#Account:F#Flow:O#Forms:I#None:U1#None:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None").DataCellAnnotation

     

    You can then do 

    If ResultCellEx.DataCellAnnotation.Length < 1 Then

    • WillVitale's avatar
      WillVitale
      Contributor

      Just to make sure. Can I added to the original code I have above? I need it be both if the amount is greater than 10k usd and has no annotation to cause an error.

      • MikeG's avatar
        MikeG
        Contributor III

        I would re-write it so you have a set of condition statements that will advise the user on the range and the Annotation status.  You can combine the condition statements it would be something like this: 

        If (System.Math.Abs(args.ConfirmationRuleArgs.DisplayValue) > 10000)  AND (ResultCellEx.DataCellAnnotation.Length < 1) Then
        'Range greater than 10,000 And No Annotation entered