File SO_OpenOrderWrk - Field QuantityOnHand

SUGGESTED

Where does the QuantityOnHand value come from in the SO_OpenOrderWrk file? The field value is always zero when I try to use it in an Open Order Report. I would like to pull the QuantityOnHand from the IM_ItemWarehouse file based upon the WarehouseCode.

Parents Reply Children
  • 0 in reply to David Speck

    I would use a sub-report.

  • 0 in reply to David Speck

    It isn't just the outer join... if you use a field from the optional table in a formula (like: if QuantityOnHand < QuantityOrdered then...) you have to handle the NULL values or you effectively make it an inner join.

    Yes, there are report options to help with NULL... but they have never worked as consistently for me as an ISNULL check in formulas.

  • 0 in reply to Kevin M
    SUGGESTED

    Good point, just another gotcha you have to watch out for. I have found that when nulls are a possibility,  you always have to handle them first with the IsNull function in your If or Select evaluations and sometimes it get plain annoying and redundant. My preferred approach is a formula in a section above the sub report that reset the shared variable to either a 0 or blank string. Then have every section in the sub report suppressed with a formula that sets the value for the shared formula added to the detail section. The formula does not have to return a value. Back in the main report, set the sub report to be suppressed if blank, then set the section the sub report is in to also suppress if blank. Then create a formula in the main report to retrieve the value of the shared variable and return it to the formula. This allows you you to keep your columns consisting of formulas so they export properly to column and row formats. You can optionally add a suppression formula to the section the sub report is in to suppres for item types other than 1 or any other condition you might have in mind, this should keep the subreport from being executed when it doesn't need to.

  • 0 in reply to David Speck

    Thanks everyone for the feedback. This is the first question I have posted so somewhat amazed by the depth and timeliness of the responses!

  • 0 in reply to David Speck
    SUGGESTED

    Yeah, I have a number of tricks for sub-reports to prevent extra white space and ensure proper function.

    For sub-reports, I always initialize the shared variables before each iteration.

    whileprintingrecords;

    shared numbervar QtyOnHand := 0;

    ""

    For fields that can be NULL (from an outer join... or UDF) I usually set up a formula field like:

    if isnull(UDF_stringfield) then "" else (UDF_stringfield)

    if isnull(UDF_numberfield) then 0 else (UDF_numberfield)