如何選擇列是否包含特定值否則什麼都不做大家好,
是否可以為列編寫選擇語句,如果該列不包含所需的值,它將什麼也不做,但如果該列確實包含我正在尋找的值,我可以讓它執行額外的腳本?
我有一列通知代碼,其中包含我的交易數據中的 3 個值“1-Addition”、“3-Update”和“4-Delete”。 當表被更新並且在列中恰好有“4-Delete”時,我當前對數據進行子集化,然後將其匹配/更新回原始文件以確定第一個實例(即添加或更新)和從表中刪除事務的兩條記錄。 今天是第一個更新數據並且不包含 4-Delete 的實例。 這導致我的選擇和刪除語句從表中刪除所有記錄。 當前用於選擇和刪除的 JSL 示例如下:
rowchoice = dt3 << Get Rows Where (:Notification Code == "4-Delete");
dt3 << Select Rows (rowchoice);
subdt1 = dt3 << Subset(
Link to Original Data Table (0),
Rows(),
Output Table Name ("Deletions")
);
subdt1.2 = Current Data Table ();
subdt1.2 << Delete Column (:N Rows);
subdt1.2 << New Column ("Deletions", Numeric, Continous,
<< set each value(1)
);
dt3 << Update (
With (Data Table ("Deletions")),
Match Columns (:ROL Case # == :ROL Case #, :"Card/Account Number" == :"Card/Account Number"),
Selected (:Deletions)
);
Close(subdt1.2, No Save);
rowchoice = dt3 << get rows where (:Deletions == 1);
dt3 << Select Rows(rowchoice);
dt3 << Delete Rows (rowchoice);
dt3 << Delete Column (:Deletions);
任何幫助是極大的讚賞。
回复:如何選擇列是否包含特定值否則什麼都不做效果很好! 感謝您的幫助!
回复:如何選擇列是否包含特定值否則什麼都不做據我所知,以下將起作用
rowchoice = dt3 << Get Rows Where (:Notification Code == "4-Delete");
If( N Rows( rowchoice ) > 0,
dt3 << Select Rows (rowchoice);
subdt1 = dt3 << Subset(
Link to Original Data Table (0),
Rows(),
Output Table Name ("Deletions")
);
subdt1.2 = Current Data Table ();
subdt1.2 << Delete Column (:N Rows);
subdt1.2 << New Column ("Deletions", Numeric, Continous,
<< set each value(1)
);
dt3 << Update (
With (Data Table ("Deletions")),
Match Columns (:ROL Case # == :ROL Case #, :"Card/Account Number" == :"Card/Account Number"),
Selected (:Deletions)
);
Close(subdt1.2, No Save);
rowchoice = dt3 << get rows where (:Deletions == 1);
dt3 << Select Rows(rowchoice);
dt3 << Delete Rows (rowchoice);
dt3 << Delete Column (:Deletions);
);