Hello all,
I would like to bind the instance parameter of a flex repeater to a named query where I return a number.
In this example, whatever value returns from the named query should be the new value on my instances.
In my example, value 4 is returned from the named query if I put the format as json I get this:

which is not correct and it has to be:

How should I transform this to be ale to get the instances correctly?
Found the solution:
You have to change the return format to a scalar for the named query and then return the transform script:
dict={ "instanceStyle": {
"classes": ""
},
"instancePosition": {}
}
list=[]
for i in range(value):
list.append(dict)
return list
1 Like
Note that as a general rule you should not name variables in Python list
, dict
, etc, as they shadow the builtin function names.
You can rewrite your transform to use a list comprehension to be a bit cleaner (in my opinion, anyway) and avoid the shadowing issue:
return [
{
"instanceStyle": {
"classes": ""
},
"instancePosition": {}
}
for i in xrange(value)
]
4 Likes
Thank you very much, Paul for the great information.