請問小幫手,以下語法需要怎麼修改才能達成A條件觸發後B條件才能觸發? 觸發流程大概是A->B,A->B......
Var: count(0);
If condition 1 then begin
ret=1;
count +=1;
end;
If count=1 and condition2 then begin
ret=1;
count=0;
end;
這樣對嗎? 另外有需要用else if之類的語法合併嗎?
謝謝
請問小幫手,以下語法需要怎麼修改才能達成A條件觸發後B條件才能觸發? 觸發流程大概是A->B,A->B......
Var: count(0);
If condition 1 then begin
ret=1;
count +=1;
end;
If count=1 and condition2 then begin
ret=1;
count=0;
end;
這樣對嗎? 另外有需要用else if之類的語法合併嗎?
謝謝
Hello ItsYeLizard,
當您 condition1 達成的時候不需要ret = 1,因為那時不用警示。
count只要改成1就可以了,因為 condition1 有達成即可,並不需要計算 condition1 達成幾次。
另外,如果您每天都要重新計算是否有滿足 condition1 的話最好多加入一行換日時 count 歸0。
修改後會像是:
Var: count(0);
if getfielddate("Date") <> getfielddate("Date")[1] then count = 0; //換日重置
If condition1 then count +=1;
If count=1 and condition2 then begin
ret=1;
count=0;
end;
1 評論