Hi all, we are already defining a expression rule by using a doforeach ex

Hi all,
we are already defining a expression rule by using a doforeach expresion. Now we need to redefine it because tis plug is deprecated.
By simple changing it with apply () it does not work.
Could somebody help me with redefinition on it.
Here is the rule:

=if(count(rule!Display_Harm_Details_CDT(pv!ContractDetails.Contract_Serial_Number)),"<br> <i> <b> Contract Harmonization History: <br><br></b> </i> "&ncolumntablestyled( "CCCCCC","FFFFFF", "FFFFFF", {"Version","Harmonization Members","Folder"},rule!ListofVersion_CR(pv!ContractDetails.Contract_Serial_Number),doforeach("AllHarmonizationMembesforVersion",pv!ContractDetails.Contract_Serial_Number,rule!ListofVersion_CR(pv!ContractDetails.Contract_Serial_Number)),doforeach("rule!LinktofolderfromfolderID",pv!ContractDetails.Contract_Serial_Number,rule!ListofVersion_CR(pv!ContractDetails.Contract_Serial_Number))),"")
The problem is when rule!ListofVersion_CR(pv!ContractDetails.Contract_Serial_Number) ret...

OriginalPostID-161216

OriginalPostID-161216

  Discussion posts and replies are publicly visible

  • Could you list the inputs as below, including the inputs for the query rule?

    rule!LinktofolderfromfolderID
    ri!ContractSN
    ri!Version

    ...the order of the inputs is important.
  • Basicaly HarmonizationDetails is variable defined as CDT and all data are saved in SQL datables with structure defined by it.I will sent you the structure. The rule shortly define a table in which it displayed those data. The apian key is ContractSN. In most of the cases there is only one row in displaye table. And when I redefine the previously mention rule by using apply it won't works only when there are multiple version (rows) . When only one row is display it works OK.
    Maybe this will give you some idea of what is the problem. It seems that doforeach is not working the same as apply and I don't see any other apian expression to redefining it.
    Thanks in advance,Natasa
  • I understand the issue with multiple rows and can solve it, but I need the inputs to the rules I mention above to assist you.
  • I guess you're trying to create a table with a row per list of version_CR? If that's the case, try the below.

    =if(
              count(rule!Display_Harm_Details_CDT(pv!ContractDetails.Contract_Serial_Number)),
              "<br> <i> <b> Contract Harmonization History: <br><br></b> </i> "&ncolumntablestyled(
                        "CCCCCC",
                        "FFFFFF",
                        "FFFFFF",
                        {"Version","Harmonization Members","Folder"},
                        rule!ListofVersion_CR(pv!ContractDetails.Contract_Serial_Number),
                        apply(
                                  rule!AllHarmonizationMembesforVersion,
                                  with(
                                            local!harmListofVersion_CR: rule!ListofVersion_CR(
                                                      pv!ContractDetails.Contract_Serial_Number
                                            ),
                                            merge(
                                                      repeat(
                                                                length(local!harmListofVersion_CR),
                                                                pv!ContractDetails.Contract_Serial_Number
                                                      ),
                                                      local!harmListofVersion_CR
                                            )
                                  )
                        ),
                        apply(
                                  rule!LinktofolderfromfolderID,
                                  with(
                                            local!linkListofVersion_CR: rule!ListofVersion_CR(
                                                      pv!ContractDetails.Contract_Serial_Number
                                            ),
                                            merge(
                                                      repeat(
                                                                length(local!linkListofVersion_CR),
                                                                pv!ContractDetails.Contract_Serial_Number
                                                      ),
                                                      local!linkListofVersion_CR
                                            )
                                  )
                        )
              ),
              ""
    )
  • It seems that it has some problem I have published it but followin error appear EVAL:@reason=index
  • I try to pass only the apply part and it seems that there is the problem. Am not sure why you redefine it like that and why local parameters are used. But what I can see that it won't work in any of the situation ( one or more rows).
  • Should the table have one row per version, or one row with multiple links for each version?