this is my table for example in window 1
and I want to use a parameter in window 2 that shows the text of the number that is being passed by the parameter.
Are you opening window 2 from an action in window 1? If so, use a window parameter. (Window parameters are assigned to a root container custom property of the same name when the window opens. You can then bind your label to that custom property.)
No, I have a template with components that all use the parameter of the template. I made a different window where I import a CSV file with the text list that the label has to show. so if I give my template number 4 for example the label has to show the text at number 4.
So a text list is being imported into the power table so I can assign text to a certain value and then I can say in my label expression that if the parameter is 4 that label shows the text of number 4. This is easy when I have the label and power table in the same window but not if the label is being used in an other window.
Am I still able to subtract the data of my power table like in some similar way as this code:
{Root Container.Power Table.data}[{Root Container.Num},"Tekst"]
Make sure you have the Vision workspace open in the designer (having any vision window open should work). Then select Vision Client Tags in the tag browser dropdown pictured below.
The problem I'm facing now is that this code is only available in a certain window: {Root Container.Power Table.data}[1,"ColumnName"]
The string that is in this path is what I want to pass to my vision client tag so that I can bound that vision client tag to a label in some other window. But using the expression of my vision client tag I'm not able to select my row and column of my power table.
try:
value = system.gui.getWindow('csv file test').getRootContainer().getComponent('Power Table').data.getValueAt(event.source.parent.parent.DiginNumber-1,"Text")
system.gui.getWindow('Pop-Up window/L4_CM/Digitale Ingang').getRootContainer().getComponent('Label').text = str("<html>"+ value)
except ValueError:
print "could not proceed"
I have put this code in the button I use to open the window that has the label in it that had to show the text of my power table. Based on the parameter I pass as a row number it grabs the right text for my label.
Then maybe you could create a dataset client tag from this csv instead of using it to populate the table,
then use that as a common source.
You could bind both the table and the label to that tag, using a lookup expression for the label.
Seems "cleaner" to me than fetching data from another window that may or may not be opened and may or may not contain the expected data.
with the use of a button. I have created a button that let me select a file and then put it in the power table
like this:
# In this example it is assumed that the CSV file being read was a dataset that was previously exported using system.dataset.toCSV:
# Specify file path
file_path = system.file.openFile("csv")
# Read in the file as a string
data_string = system.file.readFileAsString(file_path)
# Convert the string to a dataset and store in a variable
data = system.dataset.fromCSV(data_string)
# Assign the dataset to a table
event.source.parent.getComponent('Power Table').data = data