cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Yass
Level IV

The evaluation of the symbol is too recursive (>250 levels)

Hello,

I have a problem with a script that generates a daily report of production results. I added a part that calculates " TOP5:calculate_nok_percentages".

This is not the first time I've asked about this. the previous time it was in a different context, and it worked until today. However, when I tried to do the same for the daily report, I received this error message:

 

JMP16

JMP Alert

Error: The evaluation of the symbol is too recursive (>250 levels). During access or evaluation of percent_nok_ict, percent_nok_ict

A stack overflow has been detected. The maximum number of call levels has been exceeded. Execution has been terminated.

 

Scripts :

Lancher_Daily_Result :

 

taskkill /f /im jmp.exe
"C:\Program Files\SAS\JMP\16\jmp.exe" "D:\Project JMP\Scripts\TOP5_week.jsl"
echo Fin TOP5_week %time% >log.txt
TOP5_week.jsl :
 
Names Default To Here (1);

Include("D:\Project JMP\Scripts\TOP5.jsl");

TOP5:Do(-1, -0);
TOP5.jsl:
Names Default To Here( 1 );

TOP5 = New Namespace(
    "TOP5"
);

TOP5:get_dates = Function({},
    today_date = Format(Today(), "yyyy-mm-dd");
    start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
    evallist({start_of_month, today_date});
);

TOP5:calculate_nok_percentages = Function({dt},
    {start_of_month, today_date} = TOP5:get_dates();

    dt_top5 = dt << Summary(
        Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
        Freq("Aucun(e)"),
        Weight("Aucun(e)"),
        invisible
    );

    nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") << Get Values) << Get Keys;

    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    For(k = 1, k <= N Items(nameFilesNok), k++,
        FileRows = dt_top5 << get rows where(
            :File Name == nameFilesNok[k] & Num(Char(:Date)) >= Num(start_of_month) & Num(Char(:Date)) <= Num(today_date) & Contains(:File Name, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j <= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;

    Return({percent_nok_ict, percent_nok_fct});
);

// Define the Do function
TOP5:Do = Function ({nb_date1, nb_date2},
    //Ouverture de la table de données
    dt = Open( "/D:/Project JMP/Tables Données/SVI/TableData SVI PY.jmp", invisible );

    {percent_nok_ict, percent_nok_fct} = TOP5:calculate_nok_percentages(dt);

    current_month = Format(Today(), "Format Pattern", "<Month>", << Use Locale(0));

    date1 = Date Increment(Today(), "day", nb_date1, "start");
    date2 = Date Increment(Today(), "day", nb_date2, "start");

    dt_top5 = dt << Summary(
        Group( :Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :CodeError),
        Freq( "Aucun(e)" ),
        Weight( "Aucun(e)" ),
        output table name( "Table Top 5" ),
        invisible
    );

    /*
    //
    //
    //

    Here i have the logic of production repport.
    it's fine it works 
    
    //
    //
    //
    */


    //Création de la fenetre du top 5
    window = new Window ("TOP5",
        V List Box(
            pb = Picture Box( Open( "D:\Project JMP\Images\logo.png", png ) ),
            Border Box( Top(50),
                V List Box(
                    tb1 = Text Box("Production results report of "||Format( date2, "yyyy-mm-dd" )),
                    tb1 << Set Base Font( "Title" ),
                    tb1 << Set Font Scale (3),
                    tb1 << Justify Text("Center"),
                    tb1 << Set Width(2770),
                    tb1 << Background Color(RGB Color(225, 225, 225)),
                    
                    tb2 = Text Box ("SVI, PY"),
                    tb2 << Justify Text("Center") << Set Font Size(25),
                    tb2 << Set Width(2770),
                    tb2 << Background Color(RGB Color(240, 240, 240)),
                )
            ),
            V List Box (
                Border Box (Top (100), Bottom(100), Left (25),
                    H List Box(
                        // TOP 5 ICT
                        V List Box(
                            tb3 = Text Box( "Top 5 NOK results for ICT"),
                            tb3 << Set Base Font( "Title" ),
                            tb3 << Set Font Scale (2),
                            H List Box(
                                // column bay
                                
                                // column product ref
                                
                                // column test number
                                
                                //column %nok
                                
                                // column product name
                            )
                        ),	
                        V List Box(
                            Border Box(Top(100), Bottom(100), Left(200), Right(25),
                                V List Box(
                                    nokPercentTitle = Text Box("%Nok Percent for this month"),
                                    nokPercentTitle << Set Base Font("Title"),
                                    nokPercentTitle << Set Font Scale(2),
                                    nokPercentTitle << Justify Text("Center"),
                                    nokPercentTitle << Set Width(750),

                                    Border Box(Left(10), Right(10), Top(10), Bottom(10), Sides(15),
                                        b1 = Border Box(Left(l), Right(r), Top(t), Bottom(b), Sides(s), t1 = Text Box("ICT Nok Percent for " || current_month || " is :" || Char(Round(percent_nok_ict)) || "%" )), 
                                        b1 << Set Background Color(RGB Color(93, 173, 226)),
                                        t1 << Set Width(750) << Set Font Size(25) << Justify Text("Center")
                                    ),

                                    Border Box(Left(10), Right(10), Top(10), Bottom(10), Sides(15),
                                        b2 = Border Box(Left(l), Right(r), Top(t), Bottom(b), Sides(s), t2 = Text Box("FCT Nok Percent for " || current_month || " is :" || Char(Round(percent_nok_fct)) || "%" )), 
                                        b2 << Set Background Color(RGB Color(245, 176, 65)),
                                        t2 << Set Width(750) << Set Font Size(25) << Justify Text("Center")
                                    )
                                )
                            )
                        ),
                    )
                ),
                Border Box(Left(25), Top(50), Bottom(200),
                    //TOP 5 FCT
                    V List Box(
                        tb4 = Text Box( "Top 5 NOK results for FCT"),
                        tb4 << Set Base Font( "Title" ),
                        tb4 << Set Font Scale (2),
                        H List Box(
                                // column bay
                                
                                // column product ref
                                
                                // column test number
                                
                                //column %nok
                                
                                // column product name
                            )
                    )
                )
            )
        )
    );

    window << Maximize Window (1);
    //Enregistrement du fichier image .png et du fichier texte .txt
    window << Save Picture ("D:\Project JMP\Rapports de Production Quotidiens\Rapport du "||Format( date2, "yyyy-mm-dd" )||".png", "png");
    window << Save Text ("D:\Project JMP\Rapports de Production Quotidiens\Rapport du "||Format( date2, "yyyy-mm-dd" )||".txt");
);

Thank you for your help !
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: The evaluation of the symbol is too recursive (>250 levels)

Try adding Eval List to

Return({percent_nok_ict, percent_nok_fct});

 so

Return(Eval List({percent_nok_ict, percent_nok_fct}));

I would also suggest you try to handle local variables in your functions either by listing them or by using Default Local to avoid possible issues (or detect issues earlier) , Advanced Functions (jmp.com) - Local Symbols

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: The evaluation of the symbol is too recursive (>250 levels)

Try adding Eval List to

Return({percent_nok_ict, percent_nok_fct});

 so

Return(Eval List({percent_nok_ict, percent_nok_fct}));

I would also suggest you try to handle local variables in your functions either by listing them or by using Default Local to avoid possible issues (or detect issues earlier) , Advanced Functions (jmp.com) - Local Symbols

-Jarmo
Yass
Level IV

Re: The evaluation of the symbol is too recursive (>250 levels)

Thank you @jthi  it works !!