讀取行Read Line

重要

此版本的 Orchestrator 已達終止支援,建議您 升級至 Orchestrator 2019This version of Orchestrator has reached the end of support, we recommend you to upgrade to Orchestrator 2019.

讀取行活動會從文字檔讀取行。The Read Line activity reads lines from a text file. 您可以使用 [讀取行] 活動從文字檔讀取行,然後使用已發行的資料將它們傳遞到另一個活動。You can use the Read Line activity to read lines from a text file and pass them to another activity using published data.

此活動取代了 Opalis 6.3 中 [管理文字檔的舊版] 活動中的功能。This activity replaces functionality in the Manage Text File legacy activity from Opalis 6.3.

設定讀取行活動Configuring the Read Line Activity

您可以使用下列資訊來設定「讀取行」活動。Use the following information to configure the Read Line activity.

[詳細資料] 索引標籤Details Tab

設定Settings 組態指示Configuration Instructions
檔案File 輸入您想要從中讀取文字之檔案的路徑和名稱,或按一下省略號按鈕 ** ( ... ) ** 並流覽至該檔案。Type the path and name of the file that you want to read the text from, or click the ellipsis button (...) and browse for it.
檔案編碼File encoding 按一下省略號按鈕 ** ( ... ) ** ,然後從 [檔案 編碼 ] 下拉式清單中選取檔案的編碼格式。Click the ellipsis button (...) and select the format that the file is encoded in from the File encoding drop-down list. 確認您選取的是正確的編碼格式。Verify that you select the correct encoding format. 如果檔案使用不同的編碼格式,活動就會失敗。If the file uses a different encoding format, the activity fails.
行號Line numbers 輸入您想要從指定檔案讀取的文字行號。Type the line numbers of the text that you want to read from the file that you specified.

-若要指定行的範圍,請使用連字號:1-3。- To specify a range of lines, use a hyphen: 1-3. 這會讀取行1到3。This reads lines 1 to 3.
-若要指定特定行,請使用逗號:5、7、9。- To specify specific lines, use a comma: 5,7,9. 這會讀取行5、7和9。This reads lines 5, 7, and 9.
-合併範圍和特定行: 1-3、5、7、9。- Combine the range and specific lines: 1-3,5,7,9. 這會讀取第1到3行,以及行5、7和9。This reads lines 1 to 3, and lines 5, 7, and 9.
-若要從特定行指定到檔案的最後一行,請輸入行號、連字號和結尾: 4-結尾。- To specify from a specific line to the last line of the file, type the line number, hyphen, and END: 4-END. 這會將第4行讀入檔案的最後一行。This reads lines 4 to the last line of the file.
-若要從特定行指定為相對於檔案最後一行的行,請輸入行號、連字號、小於正負號,以及相對於結尾行的行號: 4-END<3。- To specify from a specific line to a line relative to the last line of the file, type the line number, hyphen, the less-than sign, and the line number relative to the end line: 4-END<3. 如果檔案有20行,就會從檔案讀取行4到17。If the file has 20 lines, this reads lines 4 to 17 from the file. <3 代表結尾的第三行。<3 represents the third line from the end.
-若要指定最後的行數,請輸入 LASTLINES、冒號和您想要刪除的最後幾行: LASTLINES:10。- To specify the last number of lines, type LASTLINES, colon, and the last number of lines that you want to delete: LASTLINES:10. 這會讀取檔案的最後10行。This reads the last 10 lines of the file.
-結合不同類型的作業:1-5、8、10-結尾<20、LASTLINES:10。- Combine different types of operations: 1-5, 8, 10-END<20, LASTLINES:10. 這會將行從1到5、第8行、第10行、第10行到尾端的第20行,以及最後10行。This reads lines 1 to 5, line 8, line 10 to the 20th line from the end, and the last 10 lines. 合併作業時,請勿重迭線條或線條範圍。Do not overlap lines or line ranges when combining operations. 例如,5-END,LASTLINES:10失敗,因為 5-END 作業已讀取至結尾,所以 LASTLINES:10作業無法成功,因為已讀取行,且活動失敗。For example, 5-END, LASTLINES:10 fails because the 5-END operation already reads to the end, so the LASTLINES:10 operation cannot succeed because the lines are already read, and the activity fails. 重要事項: 請勿指定不存在於檔案中的行號,而且不指定行號超過一次,否則活動將會失敗。Important: Do not specify lines numbers that do not exist in the file, and do not specify a line number more than once, or the activity will fail.

已發佈資料Published Data

下表列出已發佈的資料項目。The following table lists the published data items.

ItemItem 描述Description
檔案名稱File name 已讀取之文字檔的檔案名。The file name of the text file that was read.
檔案編碼File encoding 您在 [檔案編碼] 欄位中選取的檔編碼格式。The file encoding format that you selected in the File encoding field.
行文字Line text 已讀取之行的文字。The text of the line that was read.
行號Line number 已讀取之文字的行號。The line number of the text that was read. 針對已讀取的每一行都會建立已發佈資料項目。A published data item is created for each line that was read.
行號Line numbers 使用者在欄位中輸入的行號範圍。The line number range that the user typed in the field.