Table

jjmmss1jjmmss1 Member Posts: 32
I have created a table name Item1 and It is related with "ITEM" table(ID 27)

Both tables have same field name and data type.

I want when I put the No. in my created table it will aslo automaticcaly take the other values from ITEM table(ID 27).

How can I do?

Comments

  • IHateLinuxIHateLinux Member Posts: 223
    Hi,

    if it is that way i think about it, then just add the following code in the OnInsert-Trigger:
    1.) Get the No.
    2.) Create a record variable on table 27
    3.) Make a filter statement on Rec27
    4.) Call the CAL function transferfields
    5.) DONE

    IMHO this should work, i do not have the time to test it.

    HTH,
    Rainer
  • mightykidmightykid Member Posts: 23
    just put this code in the OnInsert trigger of your duplicate table. if you insert a record in Item1 table and the item exists in the Item table, it gets duplicated in Item1. hope i helped you :)

    IF Item.GET("No.") THEN
      TRANSFERFIELDS(Item);
    
  • bbrownbbrown Member Posts: 3,268
    TransferFields copies values between two table based on "Field No.". That means the value in Field 10 is copied to Field 10, Field 20 is copied to Field 20, and so on. Any fields without matches in the destination table are ignored. The data types must also match.
    There are no bugs - only undocumented features.
  • nasheernasheer Member Posts: 78
    How about using the OnValidate trigger of the 'No.' field in your created table?
    You can validate the existance of the your typed value with ITEM (27) table Value and transfer all the field values from the ITEM(27) to your created table.
  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
This discussion has been closed.