Forum Academy Marketplace Showcase Pricing Features

How to get a list of properties from App Type?

Hello everyone!

Is there a way to get a list of properties from App Type field?

For example, I have a data_source field where user can set their custom type:

I want to get all properties that this type can have, like:
properties.data_source.listProperties()

what does the object look like if you console.log it? It might have some method that gives you the properties. I remember seeing something where you could input a field name as a string to get its value, so there must be a way to get the list of possible keys.

@Kayami Thank you for replying!
Something like: ‘custom.{type_name}’

First you need to create a data tape and then a data source for your input fields as shown here

Once you have things set up like this you can get to the code and you could retrieve a list of all properties like this

//get all keys
const keyList = properties.things.listProperties()

//bring in the actual data
const allThings = properties.things.get(0, properties.things.length())

//create a Json representation of your data input
const jsonDataArray = allThings.map(x => {
    let obj = {}
    keyList.forEach(y => {
        Object.assign(obj, {
            y: x.get(y)
        })
    })

    return obj
})
1 Like

@jared.gibb Oh, got it, thank you so much!