Need to add multiple fields dynamically throught XML. How i will add multiple grids using XML structure dynamically

Certified Senior Developer

I have a story where I need to create a PDF document. Within this PDF, I need to incorporate multiple fields and grids. While the fields are functioning properly, I encountered an error when attempting to dynamically add grids. Interestingly, there are no errors apparent in the XML structure. However, during the process of converting the XML to PDF, an error arises.

Error: 

freemarker.core.NonStringOrTemplateOutputException: For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), or "template output" , but this has evaluated to a sequence+hash (wrapper: f.e.dom.NodeListModel):
==> wo.@vendorName [in template "fr.opensagres.xdocreport.document.docx.DocxReport@322fce7b!word/document.xml" at line 4, column 28085]

----
Tip: This XML query result can't be used as string because for that it had to contain exactly 1 XML node, but it contains 0 nodes. That is, the constructing XML query has found no matches.
----

----
FTL stack trace ("~" means nesting-related):
- Failed at: ${wo.@vendorName} auto-escaped [in template "fr.opensagres.xdocreport.document.docx.DocxReport@322fce7b!word/document.xml" at line 4, column 28083]
----




Please anyone let me know any modification so i will apply those changes

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Associate Developer
    in reply to Ankush Sharma

    Hi   

    I am also getting same error and also it works for without array

    could please convert string value for this below field

    Project Number: «${doc.TMF.docsdata.projectNumber}»

    error:

    Tip: This XML query result can't be used as string because for that it had to contain exactly 1 XML node, but it contains 12 nodes. That is, the constructing XML query has found multiple matches.
    ----

    ----
    FTL stack trace ("~" means nesting-related):
    - Failed at: ${doc.TMF.docsdata.projectNumber} aut... [in template "fr.opensagres.xdocreport.document.docx.DocxReport@26b1a457!word/header1.xml" at line 4, column 3025]

Children
No Data