Skip to main content
manjit.1486
Known Participant
June 14, 2024
Question

Cannot mul incompatible operands of type List of Variant and type List of Variant.

Hello Folks,

Please anyone guide me on this?

I am using below code and getting this error: "Cannot mul incompatible operands of type List of Variant and type List of Variant."  Basically I am multiplying two values. Any thoughts on this?

 a!textField(
                    label: "",
                    labelPosition: "ADJACENT",
                    value:product(index(ri!case, "amount", {}),
                    index(
                      ri!case,
                      "newamount",
                      {}
                    ) / 100),
                    
                    readOnly: true(),
                  ),

5 replies

stefanhelzle0001
Brainy
June 15, 2024

Yes. Index returns values wrapped into a variant. I suggest to either use dot-notation or cast the values into numbers.

karumurua531442
Participating Frequently
June 15, 2024

hi [mention:734d485eba7242aeab9bb03aafa409b0:e9ed411860ed4f2ba0265705b8793d05]  as [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05]  mentioned could try with dot notation as mentioned below

product(
    ri!case.amount,
   ri!case.newamount/ 100),

manjit.1486
Known Participant
June 17, 2024

Sure, I will try.

Brainy
June 15, 2024

Can you try the following code, i.e., replacing the index function's default value with zero ex. index(ri!case, "amount", {}) ->  index(ri!case, "amount", 0) and index(local!case, "newamount", {})  -> index(local!case, "newamount", 0)

a!localVariables(
  local!case: a!map(amount: 50, newamount: 100),
  a!textField(
    label: "",
    labelPosition: "ADJACENT",
    value: product(
      index(local!case, "amount", 0),
      index(local!case, "newamount", 0) / 100
    ),
    readOnly: true()
  )
)

manjit.1486
Known Participant
June 17, 2024

let me check this.