BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: naj ที่ พฤษภาคม 28, 2008, 14:35:10 PM

หัวข้อ: Script สำหรับ update public_note
เริ่มหัวข้อโดย: naj ที่ พฤษภาคม 28, 2008, 14:35:10 PM
สำหรับโรงพยาบาลที่ต้องมา update field public_note ของ ptnote table ให้สามารถแก้ไขได้

โค๊ด: Pascal
  1. program yindenaja;
  2. var
  3. tc:tclientdataset;
  4.  
  5.  
  6. begin
  7. tc:=tclientdataset.create(nil);
  8. tc.data :=hosxp_getdataset('select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  9. while not tc.eof  do
  10. begin
  11. i:=i+1;
  12. tc.edit;
  13. tc.fieldbyname('public_note').asstring:='Y';
  14. tc.post;
  15. showdebugtext('HN =  '+tc.fieldbyname('hn').asstring+'    >>>>>>>>   Public_note change result '+tc.fieldbyname('public_note').asstring+'   OK');
  16. tc.next
  17. end;
  18.  if tc.changecount>0 then
  19.  hosxp_updatedelta(tc.delta,'select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  20. tc.free;
  21.   showmessage('Process Done');
  22.  
  23.  
  24. end.
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: doramon ที่ พฤษภาคม 28, 2008, 15:38:38 PM
สุดยอด
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: anukul ที่ มิถุนายน 02, 2008, 18:03:27 PM
ใช้ยังไงครับ
 ???
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: doramon ที่ มิถุนายน 02, 2008, 22:32:22 PM
ต้องกดปุ่ม  ด้านบนซ้ายครับ

execute   

ครับ
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: naj ที่ มิถุนายน 03, 2008, 08:39:24 AM
ขอโทษด้วยครับ ลืมบอกวิธีใช้
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: anukul ที่ มิถุนายน 03, 2008, 14:51:40 PM
กด Exec แล้ว ขึ้น error บรรทัดที่  " ....i:=i+1;...."  ครับ

 ???
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: naj ที่ มิถุนายน 03, 2008, 14:55:55 PM
code อันใหม่ครับ
โค๊ด: Delphi
  1. program yindeenaja;
  2. var
  3. tc:tclientdataset;
  4.  
  5. begin
  6. tc:=tclientdataset.create(nil);
  7. tc.data :=hosxp_getdataset('select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  8. while not tc.eof  do
  9. begin
  10. tc.edit;
  11. tc.fieldbyname('public_note').asstring:='Y';
  12. tc.post;
  13. showdebugtext('HN =  '+tc.fieldbyname('hn').asstring+'    >>>>>>>>   Public_note change result '+tc.fieldbyname('public_note').asstring+'   OK');
  14. tc.next
  15. end;
  16.  if tc.changecount>0 then
  17.  hosxp_updatedelta(tc.delta,'select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  18. tc.free;
  19.   showmessage('Process Done');
  20.  
  21.  
  22. end.
  23.  
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: anukul ที่ มิถุนายน 03, 2008, 15:32:58 PM
เยี่ยมมากครับ อ.naj  เรียบร้อยแล้วครับ ประมาณ 7000 กว่า records

 ;D
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: naj ที่ มิถุนายน 10, 2008, 09:27:24 AM
แก้ไขเพิ่มเติมให้แสดง ลำดับที่ และ สรุปจำนวนรายการที่แก้ไขครับ จะได้ดูง่ายขึ้น
โค๊ด: Delphi
  1. program yindeenaja;
  2. var
  3. tc:tclientdataset;
  4. i:integer;
  5.  
  6. begin
  7. i:=0;
  8. tc:=tclientdataset.create(nil);
  9. tc.data :=hosxp_getdataset('select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  10. while not tc.eof  do
  11. begin
  12. i:= i+1;
  13. tc.edit;
  14. tc.fieldbyname('public_note').asstring:='Y';
  15. tc.post;
  16. showdebugtext('ÅӴѺ·Õè '+inttostr(i)+' HN =  '+tc.fieldbyname('hn').asstring+'    >>>>>>>>   Public_note change result '+tc.fieldbyname('public_note').asstring+'   OK');
  17. tc.next
  18. end;
  19.  if tc.changecount>0 then
  20.  hosxp_updatedelta(tc.delta,'select hn,public_note from ptnote where ((public_note like"") or (public_note is null)) ');
  21.  showdebugtext('...........................................................................');
  22.  showdebugtext('ÃÇÁ·Ñé§ÊÔé¹  '+inttostr(tc.recordcount)+' ÃÒ¡ÒÃ');
  23. tc.free;
  24.  
  25.   showmessage('Process Done');
  26.  
  27.  
  28. end.
  29.  
หัวข้อ: Re: Script สำหรับ update public_note
เริ่มหัวข้อโดย: Khuad ที่ มิถุนายน 10, 2008, 09:42:08 AM

..ขอบคุณ อ.นาจ  มากครับ... :D...

..ยกนิ้วให้เลยครับ... ;)....