DOCX From Dynamic Template

Certified Senior Developer

I am getting error like Premature End of file while generating Pdf how can i resolve this ?

a!localVariables(
  local!voucherDetails: if(
    a!isNullOrEmpty(ri!batchNum),
    null,
    rule!GAI_getVoucherDetails(batchNum: ri!batchNum).data
  ),
  local!batchDetails: if(
    a!isNullOrEmpty(ri!batchNum),
    null,
    rule!GAI_getBatchDetail(batchNumber: ri!batchNum).data
  ),
  local!date: today(),
  local!xmlData: if(
    a!isNullOrEmpty(ri!batchNum),
    null,
    concat(
      "<dynamic>",
      "<batch>",
      ri!batchNum,
      "</batch>",
      "<date>",
      local!date,
      "</date>",
      "<des>",
      index(local!voucherDetails, "description", {}),
      "</des>",
      "<claimname>",
      index(local!voucherDetails, "claimname", {}),
      "</claimname>",
      "<fundsource>",
      index(local!voucherDetails, "fundsource", {}),
      "</fundsource>",
      "<fundamt>",
      index(local!voucherDetails, "fundamt", {}),
      "</fundamt>",
      "<invoicedate>",
      index(local!voucherDetails, "invoicedate", {}),
      "</invoicedate>",
      "<invoicenumber>",
      index(
        local!voucherDetails,
        "invoicenumber",
        {}
      ),
      "</invoicenumber>",
      "<bankcode>",
      index(local!voucherDetails, "bankcode", {}),
      "</bankcode>",
      "<achLocationCode>",
      index(
        local!voucherDetails,
        "achLocationCode",
        {}
      ),
      "</achLocationCode>",
      "<vendornumber>",
      
      index(local!voucherDetails, "vendornumber", {}),
      "</vendornumber>",
      "<vendorname>",
      "test",
      /*index(local!voucherDetails, "vendorname", {}),*/
      "</vendorname>",
      "<addresscode>",
      index(local!voucherDetails, "addresscode", {}),
      "</addresscode>",
      "<address>",
      index(local!voucherDetails, "address", {}),
      "</address>",
      a!forEach(
        items: local!voucherDetails,
        expression: concat(
          "<edtable Sr='",
          fv!index,
          "' amt='",
          fv!item.claimamt,
          "' accnt='",
          fv!item.account,
          "' fund='",
          fv!item.fund,
          "' dept='",
          fv!item.dept,
          "' fSource='",
          fv!item.fundsource,
          "' program='",
          fv!item.program,
          "' class='",
          fv!item.class,
          "' project='",
          fv!item.project,
          "' bugRef='",
          fv!item.budgetref,
          "' />"
        )
      ),
      "</dynamic>"
    )
  ),
  local!finalXmlData: if(
    a!isNullOrEmpty(ri!batchNum),
    null,
    substitute(local!xmlData, "&", "&")
  ),
  local!isSuccess: and(
    a!isNotNullOrEmpty(ri!batchNum),
    length(local!voucherDetails) = length(local!batchDetails)
  ),
  a!map(
    pdfXmlData: local!finalXmlData,
    isSuccess: local!isSuccess,
    errorMessage: if(
      local!isSuccess,
      null,
      if(
        a!isNullOrEmpty(ri!batchNum),
        "No batch number provided",
        "Number of rows mismatch between voucher details and batch details"
      )
    )
  )
)

This is my rule to generate xml and in PM i am getting error

This is XML Output :pdfXmlData:<dynamic><batch>2023-0098</batch><date>9/22/2023</date><des>GA-2023-402 PT-091</des><claimname>GA-2023-402 PT-091-C10</claimname><fundsource>22392</fundsource><fundamt>1509.26</fundamt><invoicedate></invoicedate><invoicenumber>GA-2023-402 PT-091-C10</invoicenumber><bankcode>1300</bankcode><achLocationCode>5</achLocationCode><vendornumber>14723</vendornumber><vendorname>test</vendorname><addresscode>22</addresscode><address></address><edtable Sr='1' amt='8729.7' accnt='2' fund='10112' dept='46627402' fSource='22392' program='5680101' class='315' project='46639242' bugRef='2023' /></dynamic>,isSuccess:true,errorMessage:]

  Discussion posts and replies are publicly visible

Parents Reply Children