PricingBlog

My formula is returning null

  • stockton_f-1206459241603530772

    Stockton

    1 year ago

    Here's the code for my formula:

    function chart_js(args, ctx) {
    const type = args.type;
    const labels = args.lables;
    const chartTitle = args.chartTitle;
    const data = args.data;
    const borderWidth = args.borderWidth;
    const chartId = args.chartId;

    const config = {
    labels: labels,
    datasets: [{
    label: chartTitle,
    data: data,
    borderWidth: borderWidth
    }]
    }

    const string = `new Chart(document.getElementById(${chartId}), {
    type: ${type},
    data: ${config},
    options: {
    scales: {
    y: {
    beginAtZero: true
    }
    }
    }
    });`

    console.log('arguments in formula: ', string)

    return string
    }


    The formula is returning "null" but I would expect it to return a string value.

    What am I doing wrong?
    1206459241985220648-mythic_-_start_Toddle_editor_2024-02-11_at_9.37.05_PM.jpg
  • stockton_f-1206501502714253384

    Stockton

    1 year ago

    Here's the full screenshot of the formula
    1206501502454333531-mythic_-_start_Toddle_editor_2024-02-12_at_12.26.01_AM.jpg
  • andreasmoller-1206509259635032085

    Andreas Møller

    1 year ago

    Hi Stockton. We are looking into this.
    It looks like the formula is working inside the app, but just not displaying correctly in the formula editor.
  • lucasg-1206582736857333820

    Lucas G

    1 year ago

    Oh man I was going crazy wondering why a code was returning null
  • Good to know it was a bug 😅
  • stockton_f-1206620209285439498

    Stockton

    1 year ago

    Same 😓

    Thank you for looking into it!