Help forum

How do I use data from an API call as inputs for an Apex Graph, like in the dashy template?

  • Hausia

    2 years ago

    Looking to use data pulled from Airtable as inputs for a line graph.
  • Chris Laupama

    2 years ago

    There’s definitely a number of ways to do this.

    One would be to save the data upon success of the API call to a variable.

    Then use the data from that variable within the graph.
  • Chris Laupama

    2 years ago

  • Hausia

    2 years ago

    I'm actually pretty proud of myself, I had set everything up just the way you did haha

    But he's actually not using table data for that graph, just manual inputs (see screenshot)

    I want to know how to use arguments with actions.
    1305347556548804608-Screenshot_2024-11-11_at_2.44.14_PM.png
    ❤️1
  • Hausia

    2 years ago

    This is what I want to use
    1305351410401021973-Screenshot_2024-11-11_at_3.00.15_PM.png
  • Tod

    2 years ago

    Great energy @Hausia! Your continuous contribution to the toddle Community just made you advance to Community Level 1!
  • Chris Laupama

    2 years ago

    Arguments are just a way to pass data into the custom action.

    So think of them as variables.

    You create an argument, let’s say you create an argument called “name” then within the code you use the argument by using 'args.name'

    In that screenshot you can see on line 4 and 49 they are using 'args.containerId'
  • Chris Laupama

    2 years ago

    Okay, you will need to ensure you are shaping the data to utilise it the way that the apex library requires it to be utilised.

    Lots of ways to do that.

    We can jump on a call at some point if you want to go over it bro.
  • Hausia

    2 years ago

    Free now?
  • @Hausia
    Free now?

    Chris Laupama

    2 years ago

    Sweet ping me with meeting link
  • Hausia

    2 years ago

    Sent
  • Chris Laupama

    2 years ago

    @Victor Giron & @Lucas G

    Any thoughts?

    Trying to use the airtable data, but I think the custom action is loading before the Airtable data comes through.

    I've set a console log to show the array that passes to the custom action and it's showing it with an array of 3 empty items...

    Here's the project link: https://app.nordcraft.com/projects/peach_tion_medon_busy_rhinoceros
  • Lucas G

    2 years ago

    Test running the custom action on success of the API call
  • Use the 'isLoading' part of the call to set a placeholder graph/img
    💯1
  • Or just a spinner loader
  • Chris Laupama

    2 years ago

    Omg, didn't even think about that lol
  • Yeah, that worked
  • Legend, thank you!
    👍1
  • Hausia

    2 years ago

    @Chris Laupama english please hahaha
    😂1