Preview:
Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:0});; //Counter Value zurücksetzten

If(Connection.Connected;
    ForAll(
        DK_Stufen_DB As AS_STUFEN_DB;
        If(
            !IsBlank(
                LookUp(
                    Filter(
                        DK_Stufen_DB_Katalog;'DB_Stufen_DB_Katalog>DK_Profil_Lookup'.DB_Profil_ID = VAR_last_submitted_EditProfile_ID
                    );
                'DB_Stufen_DB_Katalog>DK_Stufen_Lookup'.DB_Stufen_ID = AS_STUFEN_DB.DB_Stufen_ID
                )
            );        
            Patch(DK_Stufen_DB_Katalog;Defaults(DK_Stufen_DB_Katalog);
                {
                    DB_Stufen_Katalog:VAR_last_submitted_EditProfile_NAME & "/" & AS_STUFEN_DB.DB_Stufen_Name;
                    DB_Stufen_Katalog_Option:false;
                    DB_Stufen_Katalog_Order:AS_STUFEN_DB.DB_Stufen_Order;
                    'DB_Stufen_DB_Katalog>DK_Stufen_Lookup':LookUp(DK_Stufen_DB;DB_Stufen_ID = AS_STUFEN_DB.DB_Stufen_ID);
                    'DB_Stufen_DB_Katalog>DK_Profil_Lookup':LookUp(DK_Profil_DB;DB_Profil_ID = VAR_last_submitted_EditProfile_ID)
                }
            );;
            Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:LookUp(COL_AppVar;var_name = "loop_counter").var_value + 1})       
        )
    );;

    If( // check if there were any errors when patch was submitted
        !IsEmpty(Errors(DK_Stufen_DB_Katalog));
            Notify(Concat(Errors(DK_Stufen_DB_Katalog);"Es ist ein Fehler aufgetreten: " & Column &": "& Message);NotificationType.Error);    
                If( // CounterVariabel in der AppVar Collection überprüfen
                    LookUp(COL_AppVar;var_name = "loop_counter").var_value > 0;
                    Notify("Es wurden " & LookUp(COL_AppVar;var_name = "loop_counter").var_value & " neue Stufen gefunden und hinzugefügt";NotificationType.Success;5000);
                    Notify("Keine weiteren Stufen gefunden. Das Profil ist bereits auf dem aktuellen Stand";NotificationType.Information;5000)
                )
    );
Notify("Es konnte keine Verbindung zum Server aufgebaut werden. Bitte die Internetverbindung überprüfen";NotificationType.Error;0)   
);;

Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:0});; //Counter Value zurücksetzten
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter