Is Dialog.Inut a better way of entering text?

couberpucouberpu Member Posts: 317
Hi,

I am using NAV 3.60 SQL option with .70b run time.

In sales order entry function -> drop shipment. I want to create purchase order based on customer ship-tos, sales line information and ordered from one vendor. I have all the information from the sales order but buy-from vendor code. If I created the purchase order without buy-form vendor code, I ran into vendor '' not find error message when adding the vendor after the PO was created. I need help on which is a better way of taking the vendor code:
1. Dialog.Input to input the vendor code then create the PO
2. Using report option page to enter the vendor then using report to create the PO
3. .....etc.
I would like to use Vendor List lookup if possible.

Please give some insight.

Thanks,
CouberPu

Answers

  • SavatageSavatage Member Posts: 7,142
    do you have the vendor no filled in for each item?

    or can it be multiple vendors?
  • couberpucouberpu Member Posts: 317
    Hi Harry,

    We order from multi. vendors. No default vendor in item. The price is in purchase price. I add code in codeunit 96 to create the purchase order -> opened the PO after the order was created but since buy-from vendor code is empty at the time, I can not rename '' vendor to new vendor.

    Thanks,
    CouberPu
  • DenSterDenSter Member Posts: 8,305
    You could program the form to show the vendor list first, and then when the user selects the vendor, you pass the vendor number into the codeunit so you can enter that vendor code into the new purchase order. Something like this:
    Vendor.RESET;
    IF FORM.RUNMODAL(0,Vendor) = ACTION::LookupOK THEN BEGIN
      // The selected vendor's "No." field can now be passed into
      // the purchase creation codeunit
      MESSAGE('The selected vendor is ' + Vendor."No." + ' ' + Vendor.Name);
    END ELSE BEGIN
      // nothing is selected, so here's where you can EXIT or ERROR out
    END;
    
    The value 0 makes the system use the default lookup form. Put that code into the OnPush event of a button on a new blank form and see how it works. You could then add a function to the order creation codeunit that accepts the vendor number into a global variable, and then the order creation would use the value of that global variable as the vendor number on the purchase order.
  • couberpucouberpu Member Posts: 317
    Hi Daniel,
    DenSter wrote:
    You could program the form to show the vendor list first, and then when the user selects the vendor, you pass the vendor number into the codeunit so you can enter that vendor code into the new purchase order. Something like this:
    Vendor.RESET;
    IF FORM.RUNMODAL(0,Vendor) = ACTION::LookupOK THEN BEGIN
      // The selected vendor's "No." field can now be passed into
      // the purchase creation codeunit
      MESSAGE('The selected vendor is ' + Vendor."No." + ' ' + Vendor.Name);
    END ELSE BEGIN
      // nothing is selected, so here's where you can EXIT or ERROR out
    END;
    
    The value 0 makes the system use the default lookup form. Put that code into the OnPush event of a button on a new blank form and see how it works. You could then add a function to the order creation codeunit that accepts the vendor number into a global variable, and then the order creation would use the value of that global variable as the vendor number on the purchase order.

    Is it possible to put the code inside the Dialog.INPUT? Just want to give a try.

    Thanks,
    CouberPu
  • David_SingletonDavid_Singleton Member Posts: 5,479
    My preferred method is to open a new form based on sales line (filter item, drop ship etc), and have the user add Vendor number (or numbers for multi vendors) to the appropriate lines. Then hit OK, adn error out if any vendors are not entered.

    Dialog boxes are not pretty. Forms are much nicer.
    David Singleton
  • couberpucouberpu Member Posts: 317
    Thanks David,
    My preferred method is to open a new form based on sales line (filter item, drop ship etc), and have the user add Vendor number (or numbers for multi vendors) to the appropriate lines. Then hit OK, adn error out if any vendors are not entered.

    Dialog boxes are not pretty. Forms are much nicer.

    Initially, I had the program opened up purchase order right away and ran into an error.

    With this design, why couldn't I just use the purchase order form?! The problem is empty Buy-From Vendor Code in both purchase header and purchase line. I try to solve this error by using Dialog, only slect on vendor, but again run into how to type in correct vendor code problem. I try to use the vendor list lookup, as Daniel suggested, without luck.

    I will give it a try. But is this it?

    Thanks,
    CouberPu
  • DenSterDenSter Member Posts: 8,305
    You don't want to ever use dialog.INPUT, ever, for anything. Dialog.INPUT is not validated at all, there is no data type validation, no field validation, no table relationship, you just get whatever someone types in. You would have to program this validation yourself anyway, so might as well program an actual lookup form instead and select a value that is actually in your database.

    You could also add a Vendor Number field to the sales line table and do a TESTFIELD on that field before you run the purchase order creation logic. That way no form at all, just a look up into the Vendor table right from the sales order entry form.
  • couberpucouberpu Member Posts: 317
    Thank ya all! \:D/ \:D/

    I added a field on sales order form just to hold the vendor code, using vendor lookup. It is working now.

    Thanks,
    CouberPu
  • DenSterDenSter Member Posts: 8,305
    Good work Couber, I knew you would pull it off one way or another :mrgreen:
Sign In or Register to comment.