Search code examples
experimental-designztree

How to use table loader in ztree?


I am programming a so-called "Alien Game" based on Billinger, Stieglitz and Schumacher in ztree. However, I am struggling to my NK matrix into ztree.

Does anyone have experience with the "table loader" function in ztree and can help me understand how I need to transform my excel/txt sheet and/or what the command is?

Thanks in advance already!


Solution

  • The table loader essentially loads a text file. Things to remember:

    • First column corresponds to the table name you'd like to import to
    • First row corresponds to the variable name
    • Values are tab separated
    • String variables should be enclosed by doublequotes

    To give an example if you want to load some entries with number and name to a table called mytable it should look like (tab instead of spaces):

    mytable    number    codename
    mytable    345       "Anna"
    mytable    943       "Bob"
    

    I am not sure about Microsoft Excel. You probably can save your sheet as a Text(tab delimited) after you add your first column for the table name and first row as the variable name. I use OpenOffice calc and to me the easiest way is to copy paste from calc to a text file.

    LibreOffice calc screenshot

    It is automatically tab separated then.

    Text editor screenshot

    The easiest way to understand what kind of format you need is to create the table of your desire in z-Tree then use table dumper. Then you can compare the format you have and the format you need.