Report data source - Sales orders

SOLVED

I've created a report that generates a label.

My report asks for the Sales order no and the line on the sales order.

The report table sources are so_salesorderheader, so_salesorderdetail and line item reference on the sales order.

Sometimes the report contains no data.

Question. Why would the sales order show the line in Sage, but not contain matching query result for the query?

Essentially psuedocode:  "select * from so_salesorderheader, so_salesorderdetail where sales order no='0012345' and line_no=2"

Ideas?

  • 0
    SUGGESTED

    because the line numbers are not always in order. You may have lines but no Line No 2.  Extract the Sales Order Detail table into Access and see what I mean.

  • +1 in reply to BigLouie
    verified answer

    You can add Line Key to the grid... note the leading zeroes.  There is no "Line_No" column in the data.

  • 0
    SUGGESTED

    To add to the conversation, the display order of the lines in S/O Entry is by LineSeqNo, which you should also add to the grid. It's a 14-digit numeric string. But it's value can change if you use Move Row Up, Move Row Down, Insert Row, Delete Row features. But if you never use these and always import your data, it will be a predictable pattern. For example 1st 3 lines will have these values:

    00000100000000
    00000200000000
    00000300000000

    So you could base your SELECT pseudo-code on that.
    But let's say this order is edited and a new row is placed in between 2 and 3. Now it will end up like this:

    00000100000000
    00000200000000
    00000250000000
    00000300000000

    This actually works well for sorting purposes on the screen and in reports. But if that can't work for you, one way around is to add your own Line No UDF then create a script that will fire off on PreTotals or PreWrite event, so that by the time the order is saved it will loop thru the lines top to bottom and set your UDF_LINE_NO sequentially, as an integer. This way you can do the original pseudo-code.

    Hope that helps. (BTW if you have kits that explode that could muddy the water here)

  • 0 in reply to Alnoor_C

    Love the feedback.

    Let me play with the two columns and see how things go. I've been using the number in the grid control, so that explains the inconsistent results.

    Thanks for taking the time to comment. All of you.

  • 0 in reply to Kevin M

    Added the LineKey to the [Lines] tab of the Sales Order. Instructed users to enter the LineKey as the line item they want a label for.  I did add some Crsytal logic that allows them just to the the abs #, saved them from entering the  leading zeroes.

    Working like a charm.

    Alnoor, Big Louie, Kevin. Muchas Gracias!!