Hi,
I am trying to make parameter path in Flex Repeater dynamic but not getting required results,
e.g.
result_val = self.parent.parent.parent.parent.getChild("MainContents_FlexContainer").getChild("CoordinateContainer_Chem_Results").getChild("FlexRepeater").props.instances[i].sample_1
for above mentioned path I want to convert sample_1 dynamic as sample_str(j)
sample = "sample_"+str(j+1)
When I convert whole path to string its giving me parse error for string to number.
As its unable to read the value from defined path.
Is there any way we can get thode value by putting dynamic parameter in path.
Thanks in advance.
Welcome to the site. Please use the </> code formatting button when posting code. It will indent properly (important for Python) and give syntax highlighting. You can use the 🖉 edit link to fix your post.
1 Like
replace:
...props.instances[i].sample_1
with:
...props.instances[i]["sample_"+str(j+1)]
But you probably first want to fetch all instances and then loop over it.
allInstances = self.parent.parent.parent.parent.getChild("MainContents_FlexContainer").getChild("CoordinateContainer_Chem_Results").getChild("FlexRepeater").props.instances
samples=[]
for i, instance in enumerate(allInstances):
samples.append(instance["sample_"+str(i+1)])
1 Like
Thanks for your suggestion.
Thank you for your response.
If we convert it to string, it does not read values assigned to respective path. It gives error as can not coerce String to Integer
Still trying to figure out how to resolve this issue.
plz post the entire code and which line that gives this error, because this does not look like an error related to the code