Using #localmacro

Using the option #localmacro can reduce the size and also the visibility of your code.

For example, you create a while select statement and you have to control date range when some value are enable (so not all the time)

You can write this kind of code :

protected void doProcess()
{
    #localmacro.CheckDateDelivery
        (salesTable.DeliveryDate >= fromDate && salesTable.DeliveryDate <= toDate)
    #endmacro

    #localmacro.CheckDateDocument
        (custPackingSlipJour.DeliveryDate >= fromDate && custPackingSlipJour.DeliveryDate <= toDate)
    #endmacro
    ;

    while select salesTable
    where (!validatedOrTransmited   || ((salesTable.MySalesStatus    == MyStatus::Transmission
                                    ||   salesTable.MySalesStatus    == MyStatus::Validation))
    && #CheckDateDelivery)
    &&    (!prepared                ||  (salesTable.MySalesStatus    == MyStatus::Prepare
    && #CheckDateDelivery))
    &&    (!delivered               ||  (salesTable.MySalesStatus    == MyStatus::Delivery))
    exists join firstOnly custPackingSlipJour
    where   custPackingSlipJour.SalesId == salesTable.SalesId
    &&     (!delivered  || #CheckDateDocument)
    {
        // code here.
    }
}