Add Flex Instances on addition of new row in Database

Hi team,

New to perspective and stuck on challenge so can anyone has done this previously.
I want to add Flex repeater instance when a new row is added in the database and show data in flex repeater parameters. is it possible through binding or we need to write script for the same.

if anyone wants more clarification will share the screenshot also.

Sourabh A

By ‘stuck on challenge’ do you mean a challenge from the Inductive University? Or from a certification test?

If it is from a Certification test, you cannot ask for help from the forums.

Hi @jonathan.taylor thanks for the reply.

But it is not for any sort of test i have a task in a project to build the about mentioned function but i am not sure about that. Nothing else.

Sourabh A

Alrighty then

You will most likely need to bind initially to a named query that retrieves the relevant data, then use a script transform to format that data into the structure required by the flex repeater and the view’s required parameters. You would have to have this poll the data frequently to get the most up to date data.

Your script tranform might look something like this, where your parameters are different:

array = []
for i in value:
	array.append({'param1':i['param1'],'param2':'Something',"instanceStyle": {"classes": ""}, "instancePosition": {}})
return array

A more efficient way would be to trigger a poll on change (refresh the binding), but it really depends on where that new row in the database table is coming from - if it is within the project you could use messaging to update it.

Thanks @jonathan.taylor i will try this later the day as i dont have access to oracle db rightnow.
Only one thing i want to point out is we have 10column and i want to have data of only 4 column to display on flex repeater so i have to write the column name in the script and parameters or other.

Sourabh A

Write your query to only fetch the 4 columns you’re interested in. No point in querying the whole thing then use only 4 tenth of it.