Hi, I have a question, I’m seeing the Ignition demo Project and in the document storage windows there is a tree view that display folders from a database and a table that dysplay documents. I wondering if I can display document from a local folder like “c:\reports” and show them in the table, I saw the dataset of the tree view and there is a path column, but I’m no sure it’s posible.
Yes it’s possible. You have to populate the Tree View’s Items dataset. Just as an example, the following script looks for all files and subdirectories under a directory and creates a dataset that is written to the Tree View:[code]import os
treeView = event.source.parent.getComponent(‘Tree View’)
headers = system.dataset.getColumnHeaders(treeView.data)
rows = 
for path, dirs, files in os.walk(’/home/user/downloads’):
for f in files:
newRow = [
data = system.dataset.toDataSet(headers, rows)
treeView.data = data[/code]In this case you could then carry out whatever action you want whenever the selectedPath property of the Tree View changes. (Note that the selectedItem property is set to -1 when you click on a directory name and an integer >= 0 when you click on a file name.)
You can of course just display directories or just files in a directory as required, just change what you use to populate the dataset.
I’ve using Linux here, so make sure you set your path and the Tree View Separation Character as required for Windows.