1. Overview
  2. Tutorials
  3. Generating a text file containing Table name and Primary key

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.

  1. 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.
  2. Add a new FOLDER node, and call it "temp". The files we want to generate are going to be created in this folder.
  3. Add a FILE node to this folder.
  4. Rename the label of the file node to "[%CS_TABLE%].txt".  See TableList for more information on the features of this code nanite.CS_clip0037

  5. 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%]CS_clip0036

  6. Generate the code

You will see the files generated:

CS_clip0039

CS_clip0040

So what happened here?

My Table Name is: [%CS_CURRENT_TABLE%]

My Primary Key is: [%CS_PRIMARY_KEY%]


Was this article helpful?