script for extended item description in BOM

HI

I am new to scripting and am trying to create a script for a client that will bring in the extended item description into t

Parents Reply
  • 0 in reply to Kevin M
    First off, this is line

    rv = oBusObj.GetValue("ItemCode$", ExtendedDescriptionKey)

    is getting the ItemCode from the BM_BillDetail file NOT the Extended Description Key.


    Use the value from this to look up the CI_Item record first.

    Once you have that CI_Item record you can get the Extended Description Key from that record to look up what you need in the CI_Extended Description file.
Children
  • 0 in reply to TomTarget
    (Actually, there is no field called "ItemCode" in BM_BillDetail, so that line is getting nothing).
  • 0 in reply to Kevin M
    this is what I did
    step one- create a UDF in BOM detail- I called it ext_Item_des.

    I did a column post validate, field is component item code. extended description key. I have done some other scripts but this one is really challenging me..
  • 0 in reply to [email protected]
    As I said previously: put message box pop-ups in your script to walk through the values as you step through the process.

    You will learn more that way.
  • 0 in reply to Kevin M

    I do not understand what you mean...sorry I am about ready to give up
    someone on our team can help me. 

  • 0 in reply to [email protected]

    lfelsch,

    I'm not trying to be mean here.. If you really want to do scripting, you really need to get some training on scripting and data structures within Sage 100 to get the basics. Without an basic understanding, it is really hard to help you. Teaching sufficient basics to get you started is well beyond what we can do here. :(

    I sympathize because I remember trying to get started and was confused at first, but I did some training. If I recall correctly Sage U has some that really helped me to get jump started. It took many hours going through them but it gave me a place to start.   And even after years of doing some of this, I went to a two day class last year before Sage Summit in Chicago and learned many more things.  XKZERO has some good classes for beginners and intermediates.
     
    If you don't want to make that commitment, you really should talk with your Sage Partner (and not all Sage Partners will be fluent in coding either) to get some help. This isn't a really complex project but it's going to take a little time to code and debug.

  • 0 in reply to TomTarget
    Thanks Thom! I completely agree. I do want to take the class at Xkzeo, I went thru some of his webinars and everything makes since but if you do not continue to use what you learn you forget. that is where I am at now. I will get it figured out, I have done some really simple stuff and this doesn't seem that hard, I just need to take the time to think it thru and I have nto had the time yet. I will this weekend thou. thanks again!
  • 0 in reply to [email protected]
    I mean put something like this in your script to check on progress.
    retVal = oBusObj.GetValue("ItemCode$", ExtendedDescriptionKey)
    retVal = oSession.AsObject(oSession.UI).MessageBox("ExtendedDescriptionKey: " & ExtendedDescriptionKey)
    This will pop-up a message to show you the value of this variable, so you can make sure the value is what you expect... instead of being wrong for some reason (requiring you to figure out why and fix it).
  • 0 in reply to [email protected]
    This might help. We have two descriptions. One is the normal and one is contained in a UDF. When we write a purchase order we want the normal item description replaced with the description in the UDF. I wrote this script with the help of the Boy Wonder Elliott. Should work for you by replacing some values. Notice the part about GetChildHandle.

    Sub PostValidation_ItemCode500(column,value)

    retVal=0
    itmCode=""
    oItmSvc=0
    Notes=""
    Desc=""

    retVal=oBusObj.GetValue("ItemCode$",itmCode)
    retVal=oBusObj.GetValue("ItemCodeDesc$",Desc)
    oItmSvc = oBusObj.GetChildHandle("ItemCode")
    set oItmSvc=oSession.AsObject(oItmSvc)
    retVal=oItmSvc.Find(itmCode)
    retVal=oItmSvc.GetValue("UDF_PURCHASE_ORDER_NOTES$",Notes)
    If Notes <>"" Then retVal=oBusObj.SetValue("ItemCodeDesc$",Notes)

    End Sub
  • 0 in reply to [email protected]
    Make sure you study the file layouts. A lot of your problems revolve around trying to use fields that are not present in the file you are trying to query as Kevin mentioned.

    Also not that an extended description can be up to 4096 characters which can significantly increase the size of your data files by adding a UDF for that. That's why the extended descriptions are maintained in a separate file all to themselves and are accessed by using a key index.

    As Kevin indicated earlier in this thread, I'm not entirely sure why you would want to actually drag the description into the BM_detaillines file. When you are on the lines tab in Bill of Materials Maintenance there is a button (about half way across the panel ) that you can click and it will display the extended item description.

    And if you are trying to create a custom report or modify a report you can just link to that file to get it.
  • 0 in reply to BigLouie
    Awesome! thank you for the info!!! I will give it a try this weekend! :)