Random wrong results from expression rule in process model

Hi, we are having a problem executing an expression rule, which contains an a!queryRecordType, where we have:
- 1 grouping field
- 1 measure field
- 4 filters, 

on a batchsize of 500 items.
In detail, every time we try the rule from expression rule the result is correct but when we insert it in a script task from process model it randomly gives wrong results (correct measure corresponding to wrong group fields). A delay of 1 minute after last node has also been inserted in the process  activity.

What could be the problem?

Thanks, 

Francesca

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Such random issues are extremely difficult to find. Especially when we have no details. Can you share some?

  • Probably the parameters differs on each execution in the PM..... 

  • 0
    Certified Lead Developer

    More details on the expression rule please

  • Hi, this is the first part of the expression rule we call from the process, stored in a local variable because is a partial elaboration of the ER.

    Saving its result we can see sometime is not correct in DATA field of the map (we have the right number of element in the map, with correct measure but wrong group). 

      a!queryRecordType(
        recordType:  'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD',
        fields: a!aggregationFields(
          groupings: {
            a!grouping(
              field: 'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD.fields.{4aa8d14a-37a8-49b3-83cd-a53638bc83e8}DATA_PAGAMENTO',
              alias: "DATA",
              interval: "DATE"
            )
          },
          measures: {
            a!measure(
              function: "SUM",
              field: 'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD.fields.{ce39a834-36e1-4d1e-a837-166a14889542}IMPORTO_PAGATO',
              alias: "IMPORTO"
            )
          }
        ),
        filters: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: 'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD.fields.{d8a3e8d0-eebc-4c54-8fbd-8fda411c4502}TIPO_COMMISSIONE',
              operator: "in",
              value: {cons!FET_tipoCommissioneCreditoReteEsternaAssociazioni, cons!FET_tipoCommissioneCreditoReteEsternaAgenti}
            ),
            a!queryFilter(
              field:  'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD.fields.{f0d2064b-9f01-44ba-81a0-97ffa82a0ddf}STATO_COMMISSIONE',
              operator: "in",
              value: {"PAGATE"}
            ),
            a!queryFilter(
              field: 'recordType!{8d214138-b859-4710-9cea-02edebba758c}RECORD.fields.{0cd4413f-de42-4a9e-935c-176e414421bd}DATA_CREAZIONE',
              operator: ">",
              value: cons!FET_DataCut
            ),
            a!queryFilter(
              field: 'recordType!{8d214138-b859-4710-9cea-02edebba758d}RECORD.fields.{4aa8d14a-37a8-49b3-83cd-a53638bc83e8}DATA_PAGAMENTO',
              operator: "not null"
            )
          },
          ignoreFiltersWithEmptyValues: true
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 500
        ),
      ).data ,

  • RIGHT ANSWER:

    • Mappa
        • IMPORTO 0(Numero (decimale))
            • DATA 12/04/2024(Data)
              • Mappa
                  • IMPORTO 0(Numero (decimale))
                      • DATA 16/04/2024(Data)
                        • Mappa
                            • IMPORTO 440(Numero (decimale))
                                • DATA 13/06/2024(Data)
                                  • Mappa
                                      • IMPORTO 0(Numero (decimale))
                                          • DATA 16/07/2024(Data)
                                            • Mappa
                                                • IMPORTO 0(Numero (decimale))
                                                    • DATA 17/07/2024(Data)
                                                      • Mappa
                                                          • IMPORTO 335(Numero (decimale))
                                                              • DATA 18/07/2024(Data)
                                                                • Mappa
                                                                    • IMPORTO 4103.47(Numero (decimale))
                                                                        • DATA 23/07/2024(Data)
                                                                          • Mappa
                                                                              • IMPORTO 675(Numero (decimale))
                                                                                  • DATA 06/08/2024(Data)
                                                                                    • Mappa
                                                                                        • IMPORTO 910(Numero (decimale))
                                                                                            • DATA 07/08/2024(Data)
                                                                                              • Mappa
                                                                                                  • IMPORTO 195(Numero (decimale))
                                                                                                      • DATA 09/09/2024(Data)

                                                                                                    EXAMPLE OF A WRONG ANSWER:

                                                                                                    • Mappa
                                                                                                        • IMPORTO 0(Numero (decimale))
                                                                                                            • DATA 12/04/2024(Data)
                                                                                                              • Mappa
                                                                                                                  • IMPORTO 0(Numero (decimale))
                                                                                                                      • DATA 16/04/2024(Data)
                                                                                                                        • Mappa
                                                                                                                            • IMPORTO 440(Numero (decimale))
                                                                                                                                • DATA 08/02/2024(Data)
                                                                                                                                  • Mappa
                                                                                                                                      • IMPORTO 0(Numero (decimale))
                                                                                                                                          • DATA 22/02/2024(Data)
                                                                                                                                            • Mappa
                                                                                                                                                • IMPORTO 0(Numero (decimale))
                                                                                                                                                    • DATA 17/03/2024(Data)
                                                                                                                                                      • Mappa
                                                                                                                                                          • IMPORTO 335(Numero (decimale))
                                                                                                                                                              • DATA 15/03/2024(Data)
                                                                                                                                                                • Mappa
                                                                                                                                                                    • IMPORTO 4103.47(Numero (decimale))
                                                                                                                                                                        • DATA 23/07/2024(Data)
                                                                                                                                                                          • Mappa
                                                                                                                                                                              • IMPORTO 675(Numero (decimale))
                                                                                                                                                                                  • DATA 06/08/2024(Data)
                                                                                                                                                                                    • Mappa
                                                                                                                                                                                        • IMPORTO 910(Numero (decimale))
                                                                                                                                                                                            • DATA 09/04/2024(Data)
                                                                                                                                                                                              • Mappa
                                                                                                                                                                                                  • IMPORTO 195(Numero (decimale))
                                                                                                                                                                                                      • DATA 09/09/2024(Data)
                                                                                                                                                                                                  • 0
                                                                                                                                                                                                    Certified Lead Developer
                                                                                                                                                                                                    in reply to francescai9347

                                                                                                                                                                                                    Are you passing any values to this rule while invoking it in the script task. If yes can share that details

                                                                                                                                                                                                  • Yes, in the following part of the expression rule we use a rule input but values are used only after the evaluation of this query.

                                                                                                                                                                                                    In detail, we run 2 different query, stored in 2 different local variable and we use the rule input to evaluate a third local variable with one of the 2 preceeding.

                                                                                                                                                                                                    E.g

                                                                                                                                                                                                    local1:   a!queryRecordType(...),

                                                                                                                                                                                                    local2:   a!queryRecordType(...),

                                                                                                                                                                                                    local3: if(ri!input="1", local1, local2)

                                                                                                                                                                                                  • 0
                                                                                                                                                                                                    Certified Lead Developer
                                                                                                                                                                                                    in reply to francescai9347

                                                                                                                                                                                                    With so many dependencies on private data, it is impossible for me to say anything.

                                                                                                                                                                                                    When I had similar issues in the past, I sooner or later had a facepalm moment once I understood that I was the problem.

                                                                                                                                                                                                    BTW, why do you do both queries, just to throw away the result of one of it.