Skip to content

card.execute

Returns an executed card with specified context & arguments in a specified format.

js
card.execute(cardID, contextValues, arguments, format);

Parameters

  • cardID - The ID of the card to execute.
  • contextValues - A dictionary defining the element to use for every dimension in the card's context. Each key is a dimension's ID. Each value is the value of that dimension in the card's context.
  • arguments - A dictionary defining arguments to pass to the card being executed. Each key is the name of the argument. Each value is the value of that argument. Width and height are common arguments.
  • format - The format to output the executed card to. Defaults to live. Other formats can be pdf, svg & png.

Example

js
let dimValues = {
    "c4ca4238a0b923820dcc509a6f75849b": "Closing Balance",
    "c81e728d9d4c2f636f067f89cc14862c": "Amount",
    "eccbc87e4b5ce2fe28308fd9f2a7baf3": "2021",
    "a87ff679a2f3e71d9181a67b7542122c": "Amount",
    "e4da3b7fbbce2345d7772b0674a318d5": "2002",
    "1679091c5a880faf6fb5e6087eb1b2dc": "AUD",
    "8f14e45fceea167a5a36dedd4bea2543": "Total Labour",
    "c9f0f895fb98ab9159f51fd0297e236d": "no count",
    "45c48cce2e2d7fbdea1afc51c7c6ad26": "Aug",
    "d3d9446802a44259755d38e6d163e820": "Actual",
    "6512bd43d9caa6e02c990b0a82652dca": "All Departments",
    "c20ad4d76fe97759aa27a0c99bff6710": "Net Profit/(Loss) after Income Tax"
}

let pdf = card.execute("7815696ecbf1c96e6894b779456d330e", dimValues, { "width": dashWidth, "height": dashHeight }, "pdf"); 
let fileName = "FinancialReport" + month + year + ".pdf"; 
notification.attachmentsAdd(fileName, pdf);