How to copy a row or just few collummns from one table to another using a button
Where I can find any more detailed information about Ninox commands and language, I am struggling to finish my data base because I can't find enough info about how to use visual and text commands. I have seen all available info at "https://ninoxdb.de/en/manual/calculations/reference-of-functions-and-language" and also videos on youtube but it is not enough.
I am looking for a code to make whole row or in the best case 2 colummns (Inventory ID and Inventory Name) from table "Inventory List" copy to table "Delivery List" using a button. Button will be added to the table "Inventory List" , im just choosing item then clicking on the button and entry goes to my table "Delivery List"
6 replies
-
With this code (button in Inventory List table) you can copy records to another table.
---
let variable1 := Inventory_Field1;
let variable2 := Inventory_Field2;
let variable3 := Inventory_Field3;
let c := (create 'Delivery List');
c.(Delivery_Field1 := variable1);
c.(Delivery_Field2 := variable2);
c.(Delivery_Field3 := variable3)---
Examine the code and change the field names to match yours.
This will copy 3 fields, you can add more fields if you like.
-
Nice, got it! Works smooth! Thank you!
-
Hello Guys,
Why can't one just do:
let c := (create 'Delivery List');
c.(Delivery_Field1 := Inventory_Field1);
c.(Delivery_Field2 := Inventory_Field2);
c.(Delivery_Field3 := Inventory_Field3)?
-
It's a matter of context. Inside the parentheses "c.( … )", the context is the just created record of the table "Delivery List", designated by the handle "c". When you put the identifier "Delivery_Field1" inside the parentheses, it designates the field so named of that record, and its OK. If you put the identifier "Inventory_Field1" inside the parentheses, you are trying to designate a field so named of that same record, which does not exist.
-
You can give the Inventory recor a handle and then use it, such as
let a:= this;
let c := (create 'Delivery List');
c.(Delivery_Field1 := a.Inventory_Field1);
c.(Delivery_Field2 := a.Inventory_Field2);
c.(Delivery_Field3 := a.Inventory_Field3)you can also use this format
let a:= this;
let c := (create 'Delivery List');
c.(Delivery_Field1 := a.Inventory_Field1;
Delivery_Field2 := a.Inventory_Field2;
Delivery_Field3 := a.Inventory_Field3)Regards John
-
Thanks guys!
I think all would benefit with a clear explanation of scope and types returned for certain functions. The manual that serves as reference for NX script leaves a ton to be desired.
In this instance you've clarified my doubts!
Content aside
- 2 yrs agoLast active
- 6Replies
- 1127Views