ulisses
ulisses

Reputation: 1569

How to Check the Batch Promt action choice, in Batch processing?

In my customClass extends RunBaseBatch in method main I need to check the choice selected in to Batch Promt (if is OK or Cancel), in case the Flag Batch processing is selected ON.

BatchDialog

server public static void main(Args _args = null)
{
    MyCustomClass_BATCH localMyCustomClass_BATCH;

    localMyCustomClass_BATCH= new MyCustomClass_BATCH ();

    if (localMyCustomClass_BATCH.prompt() )
    {
        localMyCustomClass_BATCH.run();
    }   

    // HERE I want to check the action selected, if it's OK or Cancel.
}

Thanks all.

Upvotes: 2

Views: 1643

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18061

If prompt returns true, OK was pressed and it is not in batch. It returns false, if cancel is pressed or batch was selected.

The OK/Cancel does not belong to the Batch pane, but to the runbase dialog as such.

You can test whether batch was selected or not, but I do not see a great use case for this.

server public static void main(Args _args)
{
    MyCustomClass_BATCH myThing = new MyCustomClass_BATCH();    
    if (myThing.prompt())
        myThing.run(); // OK, not in batch
    else if (myThing.batchInfo().parmBatchExecute())
        info("We will go batch");
    else
        info("Action cancelled");
}

The myThing.batchInfo().parmBatchExecute() will return false if Cancel was pressed, even if "Batch processing" was checked in the dialog. Check the source of RunBaseBatch.prompt to see why.

Upvotes: 4

Related Questions