Skip to Content
author's profile photo Former Member
Former Member

Getting default warehouse for item from item master form

Hi,

I have a requirement where i have to be able to pick up the default warehouse set for an item in Item Mater Data form Inventory data tab.

When a user clicks on the Add button on the form, i have to get the default warehouse selected, before the item is added in the item master table.

How can this be done?

Sample codes will be a grea help.

Thanks.

Satish

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 11:17 AM

    Hi Adele,

    I had thought about this approach, but it can be pretty dangerous.

    Thanks

    Satish.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 09:27 AM

    Hi Satish,

    I don't really understand your question, but if you want to know how you can get the default warehouse it is as follows:

    select DfltWH from OITM where ItemCode = 'MyCode'

    or do you want to know whether they selected a default warehouse before adding an item?

    I hope this answers your question, if not, please explain again.

    Adele.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 09:37 AM

    Hi Adele,

    Yes i want to get the default warehouse, before the item is added.

    Thanks,

    Satish.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Satish,

      I have tried to solve your problem by attempting to loop through the matrix and see which row is bold (if there isn't a bold cell in the first column, you know that there aren't a default warehouse set). But the TextStyle property of the Edit Text is always 0 (and not 1 for bold). I have no idea why. So this way it is not going to work.

      The only other way I can think of is if you catch the item_pressed (BeforeAction = False) event of item # 187 (which is the "Set Default WH" button and then check which row is selected by using GetNextSelectedRow. You can save this value in memory.

              oForm = oApplication.Forms.ActiveForm
              oMatrix = oForm.Items.Item("28").Specific
              iRow = oMatrix.GetNextSelectedRow()
              oEdit = oMatrix.Columns.Item("1").Cells.Item(iRow).Specific
              DefaultWH = oEdit.String

      The you catch the add button's item_pressed event (Item #1) and check if you have a value in your "DefaultWH" variable that you saved in the procedure above. If not, you know there is no default warehouse and if you do have a value, you know it's the last time the Default WH button was pressed.

      This will however only work for Add action and if the value is changed before pressing update. If it is an exsting record, the value can be retrieved from the database value in my previous post.

      This is not neccessarily the best or right way to do this, but I don't know how else... anyone can help?

      I hope this makes sense as I am starting to confuse myself 😊

      Adele

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.