0

Rest api dynamic data source

Can't really get why is this so complicated.

I need the most basic functionality:

  1. Get the data from the first URL (lets call this "room")
  2. Do the second query with the data from the first query (name for this in this example: "furnitures")

I have two datasources, the second one is a dynamic source with a variable.

Everything seems fine as far as I don't try to use the data from the second one. The documentation here gets pretty blurry.

MAPFLAT(&Column: RoomID, "roomID", @/Response/Room/ID;) - with this I'm getting a simple error saying nothing else. Just an error: "An error occured while trying to calculate".

On this point with the available documentation and the lack of error messages I have no idea what to do.

1 comment

  • 0
    Avatar
    Meggan King

    Hello

    Dynamic data sources are an advanced function. They work great for paginating data sources, but it is more complex to use them in the case you are describing. However, there may be a quick solution. It could be a problem with the variable, or it could be a problem with the data being returned - the @/Response/Room/ID;

    Is there data being returned in @/Response/Room/ID? Can you see any dynamic instances on the /debug_info view?

    If there are no dynamic instances, then you can try the steps below:

    First step - test your dynamic data source by replacing "props.roomID" with an actual working RoomID. Does that work? If so, move on to the next step.

    I assume you've evaluated the column RoomID in your MAPFLAT and there is a list of data returned? What do the IDs look like? If they are numeric, you may want to wrap a NUMBERFORMAT around the column.

    If you replace the column and just take one RoomID to start, it will be easier to debug. In the Klip Editor, you should make sure the variable "roomID" exists and is given a real default value. In this case, use the RoomIDs you have confirmed works when you run the dynamic data source with the props.variable replaced with the RoomID. Now test the MAPFLAT. What is returned? 

    If you have dynamic instances, and the MAPFLAT is still failing, it may mean one of the instances are missing data. You can easily check this by clicking the 'data' option on the /debug_info view. Check that the path is correct and there is data. Sometimes with MAPFLAT there is just one instance which is missing the path - so maybe an instance that has /Response, but does not have /Response/Room. 

     

    You can report back here, or you can open a support ticket at support@klipfolio.com after you've tried some of the above steps. 

     

    Thanks

    Meggan

Please sign in to leave a comment.