Skip to main content

Line loop schedule on non approved orders

Answered

Comments

7 comments

  • Yaremi Miranda Lopez

    Hello David,

    Can you please provide a screenshot of the module where you want to add the button? In this case, it's not possible to schedule the execution of a lineloop. The only Universal Functions with this feature are UFFI/EFFE and .Net

  • David Erkelius

    Hi Yaremi, 

    If it´s not possible to schedule it I think its best to create the button at my SQL report which shows non approved orders (see attached screenshot). So I would need a button that makes a line-loop och each Salesorder shown at the SQL report, that line loop calls for my other line loop (macro) which do the checking and changes on the order rows, (correct?). Please give me a hint for how the code for the button would look like.

    Then I just have to wait for the B1UP release that can do this SQL report and "push the button" on a schedule :) 



     

  • David Erkelius

    Hi, I still have some problems with my line loops. The main Loop which starts with the button at the torm shown above:

    OpenForm(17|$[$BOY_1.DocEntry.STRING]); // Open the Sales Order
    Activate(); //Activates the sales order form we opened.
    UF(UF-001); //Calls for the line loop för Sales Orders
    Close(); // Close the Sales order
    AutoPressNextPopup(); //I want two answer "Yes" to the question if I want to save. It doesnt Work

    The UF-001 works fine for the first entry, but stops at the Close(); Command and asks if I want to save the changes. After that the main loop stops.

    I have also tried Activate and Click command, but I cant get it to work. Can someone please help me

    /David 

     

     

  • Thomas

    Hi David,

    The AutoPressNextPopup(); needs to be before Close();

    From the manual (press f1 while editing a macro):

    In order to work you need to call this command BEFORE you execute the command that cause the popup. The command can be called with either zero, one or 2 commands.

     

    I hope this helps.

    Best regards,

    Thomas

  • David Erkelius

    Of Course! Thanks, next problem is that some orders exceeds the credit limit, so I want to AutoPress that System Message as well. I tried AutoPressNexPopup, SendKeys and Click, but I cant get it to work. How 

    OpenForm(17|$[$BOY_1.DocEntry.STRING]); //Opens the Sales order Activate(); UF(UF-001); //Calls for the line loop för Sales Orders
    @STORE1 = SQL('SELECT OCRD.CreditLine FROM OCRD WHERE CardCode = $[ORDR.CardCode]'); //Credit limit
    IF (@STORE1 < $[$29.0.NUMBER]) // If credit limit exceeded
    BEGIN
    AutoPressNextPopup(); //Update
    Close();
    //AutoPressNextPopup($[$1.0.0]); // Yes I want to continue anyway
    //Activate();
    //SendKeys({ENTER}); // Yes I want to continue anyway
    //Click($[$1.0.0])); // Yes I want to continue anyway
    END
    ELSE
    BEGIN
    AutoPressNextPopup(); //Update
    Close();
    END

    /David

     

  • Thomas

    Hi David,

    Try to add two lines of autopressnextpopup before closing. 

    Best regards,

    Thomas

  • David Erkelius

    Great! It worked. Thanks! :) 

     

Please sign in to leave a comment.