Need help with table component

I need help with table component.
スクリーンショット 2023-12-13 141424
This is my table.
Can you tell me how to get the value from table.
For example in the photo, when the user click on the first one and click copy button, it will store the image in main folder inside of ignition and show the image in Image component.


I did with the text field but I don't know how to do with table component.
This is my python code for text field.
def runAction(self, event):
import shutil

#テキストフィールドに指定したファイルをIgnitionのWebサーバーにコピーする
path1 = self.getSibling("TextField_1").props.text
path2 = r"C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main"
shutil.copy(path1, path2)

#################画像表示
import os
#ファイル名だけ取得
basename = os.path.basename(path1)
#ファイル名だけ取得して、/とかけあわせた物をsourceに入れる
self.getSibling("Image_4").props.source = '/' + (basename)

Can you tell me how can I do the same thing with table component.
Thank you have a nice day

Assuming the Table and Button are siblings in the same Container, you could use this script to capture an image of the Table:

self.getSibling("TableNameHere").requestPrint("component", "ImageTitleHere")

This will save an image of the component to the CLIENT. To display the image file in the Image component, you need to upload the file saved on the client to the Gateway. This will require use of the File Upload component.

I suspect the only reason your script is working is because you're using the same machine for both Client and Gateway.

Side note:
While you might find recommendations to save photos to the webapps/main directory here in the forums, that route is officially unsupported and could stop working at any point in the future without warning. Just because it works does not mean it is supposed to work. It's highly recommended you serve resources through either the WebDev module, a third-party module, or an external resource server (Photobucket/S3).

2 Likes

Aung_pyaesan, welcome to the forum. Please see Wiki - how to post code on this forum.

1 Like

Thank you for your advice and solution.

Noted !