Is there any way to make array of similar screens

I use same screens to analyse quadratic functions and name tables, graphs, mathInputs with index numbers. Is there a way to name them with index. So graph would have name g1, g2, … gn for n screen.
It would help when adding new slide.
Code sample:

#t53
#=============================================
hidden: when (t52.cellContent(1,2)=“n” and isUndefined(t52.script.x1))
or (t52.cellContent(1,2)=“N” and isUndefined(t52.script.x1)) false otherwise true

bool1 = when numericValue("\round({this.cellNumericValue(1,3)},2)")=numericValue("\round({g5.script.y3},2)") true otherwise false
bool2 = when numericValue("\round({this.cellNumericValue(2,3)},2)")=numericValue("\round({g5.script.y4},2)") true otherwise false
bool3 = when numericValue("\round({this.cellNumericValue(3,3)},2)")=numericValue("\round({g5.script.y5},2)") true otherwise false
#=============================================
cellContent(1,4): when bool1 “:white_check_mark:” otherwise “”
cellContent(2,4): when bool2 “:white_check_mark:” otherwise “”
cellContent(3,4): when bool3 “:white_check_mark:” otherwise “”

correct: bool1 and bool2 and bool3

When I add new slide I have to change index numbers for g5 to g6.
Could I code something like g(n) or g[n] and just declare variable n=6?
Thanks.

You can create a variable, like graph=g1 and set it to whichever component you want. That way you just need to change it, and the rest of the code will use that. For your code sample:

table=t52
graph=g5
hidden: when (table.cellContent(1,2)=“n” and isUndefined(table.script.x1))
or (table.cellContent(1,2)=“N” and isUndefined(table.script.x1)) false otherwise true

bool1 = when numericValue("\round( Undefined control sequence \round {graph.script.y3},2)") true otherwise false
bool2 = when numericValue("\round( Undefined control sequence \round {graph.script.y4},2)") true otherwise false
bool3 = when numericValue("\round( Undefined control sequence \round {graph.script.y5},2)") true otherwise false

This way you only need to edit the first two lines of code.

1 Like

I didn’t think it would work.
Thank you very much.