Filter Items according to item No.

aliennavaliennav Member Posts: 449
Hi
can anyone pl. tell me how to select the items according to Item No.s??

Situation:

FG items have the code as--FG-0001
I want that if user selects any FG item on Purchase line...an error should be displayed.


what should i write on validate of No. in purchase line & purchase invoice line

Comments

  • TetosTetos Member Posts: 23
    Your question seems to be unclear. You want to select FG items from Purchase Line and want to show an error when selected???

    Tetos
    --Tetos :)
  • kapamaroukapamarou Member Posts: 1,152
    First check the "Blocked" field on the item card and see how it works. If that functionality does not help you you could add a new field that you test during selection / posting.
    Avoid hard coding values like Item No. starts with specific charracters...
  • vijay_gvijay_g Member Posts: 884
    kapamarou wrote:
    Avoid hard coding values like Item No. starts with specific charracters...

    aliennav,
    i would advice you to do as Kapamarou wrote either try to do hard code "inventory Posting Group" rather than particular item.
  • aliennavaliennav Member Posts: 449
    vijay_g wrote:
    kapamarou wrote:
    Avoid hard coding values like Item No. starts with specific charracters...

    aliennav,
    i would advice you to do as Kapamarou wrote either try to do hard code "inventory Posting Group" rather than particular item.

    Hi Vijay....the solution seems to be good.

    Thanks, but if I want to hardcode the restriction according to the item code, then what should be done???
    I think it has to do something about the STRING...
    no further idea.
  • vijay_gvijay_g Member Posts: 884
    so,
    if you want to hardcode the restriction according to the item code, then how will you decide what's item no. should be equal to purchase line item no. if not then according to you
    whenever any user will make a PO the item in purchase line must be your hardcode item.

    i means is the item that you are hardcoding should be eqaul everytime when PO make?
  • aliennavaliennav Member Posts: 449
    vijay_g wrote:
    so,
    if you want to hardcode the restriction according to the item code, then how will you decide what's item no. should be equal to purchase line item no. if not then according to you
    whenever any user will make a PO the item in purchase line must be your hardcode item.

    i means is the item that you are hardcoding should be eqaul everytime when PO make?

    The Finished Goods are not supposed to be purchased as it is the manufacturing company.The code for FG items starts from FG----.
    So I want to hardcode on "ONValidate" Trigger of the Purchase Line that :

    IF Item.No = *@FG* THEN
    ERROR('You cannot pick the FG item');

    Now the problem is--> What should i write in place of *@FG* ?? because this type of filter we only use at runtime while searching (on list forms).
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Instead of writing all this code, why not get a trained Navision consultant involved, that can show you how to do this with standard Navision and no code.

    Not knowing the very basics of Navision is never a reason to just go and write some horrible code.
    David Singleton
  • deepthi.vdeepthi.v Member Posts: 62
    Hi,

    We can use setfilter instead of using condition
    if item no.=*@FG* then

    write code on onvalidate of item no.
    setfilter(itemno,'%1','*@FG*');
    if find('-') then
    error('text001');

    i think this may help u,But Hardcoded is not good to write .



    Deepu..
  • SavatageSavatage Member Posts: 7,142
    what's the point of these FG items if you can't use them - just block them?
  • aliennavaliennav Member Posts: 449
    deepthi.v wrote:
    Hi,

    We can use setfilter instead of using condition
    if item no.=*@FG* then

    write code on onvalidate of item no.
    setfilter(itemno,'%1','*@FG*');
    if find('-') then
    error('text001');

    i think this may help u,But Hardcoded is not good to write .



    Deepu..
    Thanku
  • aliennavaliennav Member Posts: 449
    Savatage wrote:
    what's the point of these FG items if you can't use them - just block them?


    I think u have not read the word
    "PURCHASE LINE".
    FG items are used for sales.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    deepthi.v wrote:

    We can use setfilter instead of using condition
    if item no.=*@FG* then

    write code on onvalidate of item no.
    setfilter(itemno,'%1','*@FG*');
    if find('-') then
    error('text001');

    Great advise Deepu, you have just shown him how to wreck the system and screw it up for the customer. Of course this will mean the customer paying more money to fix it later, but hey that's good news right.

    ](*,) ](*,) ](*,) ](*,)
    David Singleton
  • SavatageSavatage Member Posts: 7,142
    istead of hardcoding FG - if you have to do it why not put a boolean in the item table & on the item card called "Not for Purchase". then check onvalidate if the value is true or false and then call your error. at least it will be more flexable.
  • TetosTetos Member Posts: 23
    If you want only the Purchase to be blocked, then Blocking the item from the Item card should be enough. You still will be able to sell and post the sale.

    the attached table might be of help.
    --Tetos :)
Sign In or Register to comment.