Using a formula in sequence number definition

SUGGESTED

Hi all, 

I'm new to Sage X3 so I need some help.  I need to setup a custom sequence number definition for LOT managament.  Let's say my number is 230623-A.  The A would change and be typed in by the user.  I figured I could use some custom fields from Entry Transactions - Production Tracking like Lot custom text 1 which is USRFLD1 from the STOLOT table.  How would I write the formula in the Sequence definition window for the component??

Thanks in advance

  • 0
    SUGGESTED

    Hi Lori, generally speaking you can't use Sequence number definition logic for this purpose because sequence number generated by X3 still needs a counter of minimum 3 digits (somewhere in its definition), so your X3 generated sequence number should look like something like 230623-A-001 (3 last digits is the minimum which you can't go lower). if you can convince your client to have the 3 digits counter in the lot format, then your job is easier and you can still work out a nice sequence number out of X3 by pointing the formula bit = [M:MTK2]custom field (I would leave this custom field on the screen of MTK2 and not use of USRFLD1). But if your client doesn't want that counter in the lot number, I would recommend below:

    Your best bet is setting lot entry = free in product category, LOT sequence number = either leave it empty or have it assigned to a generic LOT sequence format to cover other cases of receiving this item rather than production, then update all related product master data > Lot sequence number field with the same logic = either leave it empty or have that generic LOT sequence format to cover other cases of receiving this item if it is not only through production.

    If you are worried about user manually putting something wrong in lot field now that it is allowed for lot entry, then you can make the field LOT displayed at entry transaction setup or screen level and protect it via an activity code). Your last step then is through customization of screen production tracking > add an action to this custom field with after change action and write a 4gl code to generate the LOT format you would like based on  bits and pieces of date$ and user entry of a letter (A,B,...) in your custom field to generate the LOT number you want on the screen, before data is passed on to the next screen (lot detailed entry). In my case, I had to do something similar as we wanted the LOT number to be: WO number (13 characters) + line number of production tracking (converted to 01, 02,...)  so we would generate a 15 char lot number on the spot via 4gl code. Hope this helps and please mark my suggestion as an answer if this would work for you.

  • 0 in reply to Victor Nia

    I know that I have to have a sequence number.  I just forgot to add it at the end of the example.  I tried doing the formula for the user defined field as you explained but if it tells me INCORRECT EXPRESSION - ILLEGAL CHARACTER.  The screen is STOENTLOT and the field is USRFLD1.  I did as follows: 

    =[M:STOENTLOT]USRFLD1

  • 0

    Lori,

    You’re not going to be able to use a field from the STOLOT table, as a record in this table won’t be created until AFTER the lot number has already been calculated.

    What you need to do is add a custom field into the line of the screen that you are generating the lot number from (say purchase receipt lines) and then refer to this field in the sequence number definition. You might need a little trial and error to work out if you need to refer to the SCREEN field ([M:XXX]yyy(nblig-1)) or the table field ([F:XXX]yyy) as some transactions write the table before creating the lot number.