Name not recognized when closing a data tableHello,
I am having a problem closing a data table.
I put my code below:
f_UI:details_top5_nok = Function({rank, ictFct, tab_top5, box, dt, date1, date2},
file_name = tab_top5[rank];
dt << Select Where (:Result == "NOK" & :ICT_FCT == ictFct & :Nom de fichier == file_name & Num(date1) <= Num(Char(:Date)) <= Num(date2));
dtSub = dt << Subset (
Selected Rows(1),
columns(:Date, :Nom de fichier, :Ref Produit, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError)
);
dtSum = dtSub << Summary(
Group(:Code Error, :Reason Error),
output table name("Détails "||file_name)
);
dtSum << On Close(
Close(dtSub, NoSave);
)
);When I call this function, everything goes as expected (the subset and the summary) until the last block on close. What I would like for behavior is that when I close dtSum, dtSub automatically quits. However, when I close dtSum I get the following error:
Unresolved name: dtSub when accessing or evaluating "dtSub", dtSub / * ### * /
I don't understand why I have this error because the table that corresponds to dtSub is still open when I try to close dtSum ...
Thank you in advance for your answers !
ScriptingRe: Nom non reconnu à la fermeture d'une table de donnéesI was able to replicate the issue, but I do not have a work around. Hopefully another Community Member does.
Re: Nom non reconnu à la fermeture d'une table de donnéesI've seen a similar error when the table reference is no longer in scope. My solution was as follows,
example = Function( {dt},
{dtSub, dtSum},
dt << select where( :height > 61 );
dtSub = dt << subset( Selected( rows( 1 ) ) );
dtSum = dt << summary( group( :age ) );
Eval(
Substitute(
Expr(
dtSum << OnClose( Close( Data Table( table_name ), no save ) )
),
Expr( table_name ), dtSub << get name
)
);
);
example( Data Table( "big class" ) );Re: Name not recognized when closing a data tableThanks for this solution it worked for me! I'm having a similar problem this time around with an outline box that I want to delete when closing a data table. Unfortunately I get the same error as for my previous problem. Do you have any idea how to fix it?
Re: Nom non reconnu à la fermeture d'une table de donnéesThe idea is to reference the outline box in such a way that does not rely on the variable reference. Here's an example that you can hopefully adapt for your script,
example = Function( {dt},
{dtSub, dist},
dt << select where( :height > 61 );
dtSub = dt << subset( Selected( rows( 1 ) ) );
dist = dtSub << Distribution( Continuous Distribution( Column( :weight ) ), Nominal Distribution( Column( :age ) ) );
Eval(
Substitute(
Expr(
dt << OnClose( Report( distribution[1] )[Outline Box( 3 )] << Visibility( "Collapse" ) )
),
Expr( table_name ), dtSub << get name
)
);
);
example( Data Table( "big class" ) );
I would also recommend collapsing the outline box rather than actually deleting it.
Re: Name not recognized when closing a data tableThank you very much for this information, I will try to locate my outline boxes to close them as well as possible!