Skip to main content
sivanagamalleswarit0001
Inspiring
September 4, 2023
Question

CSV Doc from Template issues

  • September 4, 2023
  • 1 reply
  • 0 views

I have a csv template which is expecting few fields(could be 100 columns).

First i created a dummy template to see if this even works and i am facing some challenges here, need some help in understanding what i did wrong.

Below CSV has the data returned however not in expected format. These are supposed to print in 3 different rows but not in same row.

Did a!foreach for each column to return its value and saved in respective variables...

my actual template:

a!localVariables(
  local!data: a!queryEntity(
    entity: cons!TST_DSE_TEST,
    query: a!query(
      filter: {
        a!queryFilter(
          field: "createdOn",
          operator: ">=",
          value: fn!datetime(2023, 7, 1, 7, 2, 5, 0)
        ),
        a!queryFilter(
          field: "createdOn",
          operator: "<=",
          value: fn!datetime(2023, 8, 1, 7, 2, 5, 0)
        )
      },
      pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 3)
    ),
    
  ).data,
  /*Did a!foreach for each column to return its value and saved in respective variables*/
  a!forEach(
    items: local!data,
    expression: joinarray(
      if(
        isnull(fv!item.columnD),
        "N/A",
        fv!item.columnD
      ),
      char(13) & char(10)
    )
  )
)

    1 reply

    stefanhelzle0001
    Brainy
    September 4, 2023

    This node is just capable of replacing simple text placeholders by a provided string. If you pass a list, it will convert it into a string representation. To make this work, you will have to write each row individually.