How to show display record on form only but not save

webweb Member Posts: 102
Hi,
How can i display a record on a form and it should not be stored in the table the form writes to?
Thanks
«1

Comments

  • SavatageSavatage Member Posts: 7,142
    are you entering this record or are you getting it from somewhere?

    Create a variable on the form and add a textbox or whatever using the var as the source exp.
  • webweb Member Posts: 102
    I am trying to display customer name but not save. I am getting the customer name from the customer table to display it on a form which is using a different table. i don't want the name to save on this table.
    can you please help me with this.
    thanks
  • bbrownbbrown Member Posts: 3,268
    Create a function on your new table [GetCustomerName]. This function would except the value of "Customer No." from your table and return a text value of Customer.Name

    Place a textbox on your form and set the source to this new function.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    Lets use Form 302 Customer Entry Statistics as an example.

    1. ot to Globals and add
    (Var)Customer
    (DataType)Record
    (SubType)Customer

    2.OnAftergetrecord of the form add
    Customer.GET("No."); //"no." is the link from your table to cust table. can be another name, perhaps "source no." where applicable. I don't know what table you're using.

    3.on the form add a textbox with sourceexp = customer.name

    4.save & compile & reopen the form

    edit BB's was too fast this time :D
  • bbrownbbrown Member Posts: 3,268
    When retrieving record for display like this using

    IF NOT Record.GET(primary key values) THEN
    Record.INIT


    will prevent run-time errors if the record does not exist.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    True, better to accept all possible conditions. \:D/

    I was imagining getting the cust name at the bottom of a cust ledger entry form or something. bad to assume.
  • webweb Member Posts: 102
    edited 2008-06-06
    I used are variable and it is displaying the customer name, but when i go to the next line to display another customer name, it is displayed but the previous one disappear. I don't want them to disappear, i want them to stay.
    here is the code i used
    Form - OnAfterGetRecord()
    Customer.GET(CustomerNo);
    CustomerName := (Customer.Name);
    
    Thanks
  • SavatageSavatage Member Posts: 7,142
    edited 2008-06-06
    you're using a table form not a card type form I can gather?
    customer table? Thought about using a flowfield? Why so against saving the cust name in the table?
  • bbrownbbrown Member Posts: 3,268
    Where did you place the function to retrieve the name? It needs to be on the table the form is using.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    (995) 5 More BBrown - BOYEEEEEE! =D> =D>
  • SavatageSavatage Member Posts: 7,142
    Ok example 2 :lol:

    Say you want the Vendor Name on the Item List.

    add globals
    Vendor - Record - Vendor
    VenName - Text - 30

    On AfterGetRecord()
    IF Vendor.GET("Vendor No.")
    THEN venname := Vendor.Name;

    Hmm but how to drop in a Vendor Name Column.
    Drop In "Vendor No." again if alreay on the list - or anyfield for that matter. View the properties of that column and change sourceexp to VenName - change caption too.

    Close - save - compile - reopen - enjoy!
  • webweb Member Posts: 102
    Its the code below ok. What is wrong with it?
    Form - OnAfterGetRecord()
    Customer.GET(CustomerNo);
    CustomerName := (Customer.Name);
    
    Thanks
  • bbrownbbrown Member Posts: 3,268
    Placing the function on the table would allow it to be re-used elsewhere. Say on a report or another form without having to replicate the same code.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    edited 2008-06-06
    looks fine, did you try it? You can use the IF option as I used above just in case customerno doesn't always exist. You would know better.

    On AfterGetRecord()
    IF Customer.GET(CustomerNo)
    THEN CustomerName := Customer.Name;
  • SavatageSavatage Member Posts: 7,142
    Do you know what BBrown means by create a function?

    Baby Steps 8)
  • webweb Member Posts: 102
    Yes it is displaying the customer name, but my problem is when i tab and go to the next link to enter, when i enter the customer the name comes but the previous one disappear. I don't want thsi. how can i make all of them stay on the form but not save.
    Thanks
  • SavatageSavatage Member Posts: 7,142
    Tab next link? I'm not sure what your form looks like anymore :-k

    as long as the cust no exists it should be pulling the custname.
  • bbrownbbrown Member Posts: 3,268
    I'm a bit confused too. I thought we were talking about a list form. What kind of form are we talking about here? A List form (displaying a scrollable list of records) or a Card Form (displaying 1 record at a time).
    There are no bugs - only undocumented features.
  • webweb Member Posts: 102
    Its a tabular form. If you enter the customer and then hit tab, the customer name appears automatically and you tab to go to the next line, it here where once you enter another customer no. that customer appear but the first/previous one disappear.
    thanks
  • bbrownbbrown Member Posts: 3,268
    Not clear on what you mean by "tabular" form. In NAV there are only 2 types of forms. (Actually 3 if you count Matrix form which are really a special list form.)

    You seem to be describing a List form that you are tabbing thru to enter information
    There are no bugs - only undocumented features.
  • webweb Member Posts: 102
    It is a form with columns and rows. matrix i believe.
    Thanks
  • SavatageSavatage Member Posts: 7,142
    edited 2008-06-06
    It's list a list form - anyway if you enter the cust number it should get the customer name. Are you setting the cust no by leaving the field/line? I do not get this disappearing problem.
  • bbrownbbrown Member Posts: 3,268
    My fault for mentioning matrix forms. :oops: I don't believe we are talking about a matrix form here.

    Does you from look something like the Customer List that you get when you push F5 from the Customer Card? That is a list form.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    are you putting your code on the c/al code of the column or the enties form?

    close form, open form. do not click on any column now go to the cal code.
    and see if that's where you placed your code.
  • webweb Member Posts: 102
    I don't know but my is disapearing. The previous one is disappearing.
    
    Form - OnNewRecord(BelowxRec : Boolean)
    EmployerName := '';
    
    I have the above code because when i go to next row/ record the previous one appear. so i did the above code to stop that. I even commented it but the previous one disappearing did not stop.
    What am i doing wrong?
  • SavatageSavatage Member Posts: 7,142
    edited 2008-06-06
    When did EmployerName get into this converastion?
    :lol::lol: :-k

    are you sure of where you placed your code?

    How much code is floating around? What table is this? a custom table?

    go back and read read the entire post and see if you did something you shouldn't have.
  • webweb Member Posts: 102
    edited 2008-06-06
    Its should be CustomerName. That is what is in the code. This is my mistake when i am posting it.
    The table where this form is using not the customer table.
    The code is on the form actually.
  • SavatageSavatage Member Posts: 7,142
    Savatage wrote:
    are you sure of where you placed your code?

    How much code is floating around? What table is this? a custom table?

    go back and read read the entire post and see if you did something you shouldn't have.
  • webweb Member Posts: 102
    I am actually using CustomerName. That is what is in the code. This is my typographical error when i am posting it.
    The table where this form is using not the customer table.
    The code is on the form actually.
  • webweb Member Posts: 102
    are you putting your code on the c/al code of the column or the enties form?

    close form, open form. do not click on any column now go to the cal code.
    and see if that's where you placed your code.
    This is were my code is.
Sign In or Register to comment.