Generating a text file containing Table name and Primary key
The aim of this tutorial is to show how you can use Code Nanite to generate a series of text files named after the tables in your database schema.
- Make sure you have some tables defined in your Database Schema. If you don't have any table you can use the Schema Importer to import an existing schema or create some tables using the Schema Generator.
- Add a new FOLDER node, and call it "temp". The files we want to generate are going to be created in this folder.
- Add a FILE node to this folder.
-
Rename the label of the file node to "
[%CS_TABLE%].txt
". See TableList for more information on the features of this code nanite. - Add the following to the contents of the node using the Code Editor:
My Table Name is:
[%CS_CURRENT_TABLE%]
My Primary Key is:
[%CS_PRIMARY_KEY%]
- Generate the code
You will see the files generated:
So what happened here?
My Table Name is: [%CS_CURRENT_TABLE%]
My Primary Key is: [%CS_PRIMARY_KEY%]