Hi All
I Have been trying to do a table update script which works!
The problem I have is if I only want to update 1 of the ten fields and leave the others blank the script updates all 10, the blank ones with 0.00.
Do I ahve to update the table 10 times or is their some other way I can do this please see my code below
Thanhs Andy
DIM SHARED Raccount as C
DIM SHARED Type as C
DIM SHARED Items as C
tbl = table.open("ratetable|c:\alphawork\alphacons\ratetable.dbf")
query.filter = "account = raccount .and. type = type .and. items = items"
DIM SHARED Zone1 as n
DIM SHARED Zone2 as n
DIM SHARED zone3 as n
DIM SHARED zone4 as n
DIM SHARED Zone5 as n
DIM SHARED zone6 as n
DIM SHARED Zone7 as n
DIM SHARED Zone8 as n
DIM SHARED zone9 as n
DIM SHARED zone10 as n
DIM SHARED varC_result as C
heading_string = "Enter Rate per Zone"
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Enter Rate per Zone",""%dlg%
{region}
{text=55,1:heading_string};
{endregion};
{region}
Enter Account Number:| [.40Raccount];
Enter Type "Plt" , "Half" , "Item":| [.40Type];
Enter Number "1" "2" etc.:| [.40Items];
Enter price Zone 1:| [%z%.40Zone1];
Enter price Zone 2:| [%z%.40Zone2];
Enter price Zone 3:| [%z%.40zone3];
Enter price Zone 4:| [%z%.40zone4];
Enter price Zone 5:| [%z%.40Zone5];
Enter price Zone 6:| [%z%.40zone6];
Enter price Zone 7:| [%z%.40Zone7];
Enter price Zone 8:| [%z%.40Zone8];
Enter price Zone 9:| [%z%.40zone9];
Enter price Zone 10:| [%z%.40zone10];
{endregion};
{line=1,0};
{region}
"*15=ok_button_label!OK" "15=cancel_button_label!CANCEL"
{endregion};
%dlg%)
'tbl = table.open("ratetable|c:\alphawork\alphacons\ratetable.dbf")
query.filter = "account = raccount .and. type = type .and. items = items"
query.order = ""
query.options = ""
idex = tbl.query_create()
update.fields = 10
update.field1 = "rzone1"
update.expr1 = "var-"zone1"
update.field2 = "rzone2"
update.expr2 = "var-"zone2"
update.field3 = "rzone3"
update.expr3 = "var-"zone3"
update.field4 = "rzone4"
update.expr4 = "var-"zone4"
update.field5 = "rzone5"
update.expr5 = "var-"zone5"
update.field6 = "rzone6"
update.expr6 = "var-"zone6"
update.field7 = "rzone7"
update.expr7 = "var-"zone7"
update.field8 = "rzone8"
update.expr8 = "var-"zone8"
update.field9 = "rzone9"
update.expr9 = "var-"zone9"
update.field10 = "rzone10"
update.expr10 = "var-"zone10"
tbl.update()
I Have been trying to do a table update script which works!
The problem I have is if I only want to update 1 of the ten fields and leave the others blank the script updates all 10, the blank ones with 0.00.
Do I ahve to update the table 10 times or is their some other way I can do this please see my code below
Thanhs Andy
DIM SHARED Raccount as C
DIM SHARED Type as C
DIM SHARED Items as C
tbl = table.open("ratetable|c:\alphawork\alphacons\ratetable.dbf")
query.filter = "account = raccount .and. type = type .and. items = items"
DIM SHARED Zone1 as n
DIM SHARED Zone2 as n
DIM SHARED zone3 as n
DIM SHARED zone4 as n
DIM SHARED Zone5 as n
DIM SHARED zone6 as n
DIM SHARED Zone7 as n
DIM SHARED Zone8 as n
DIM SHARED zone9 as n
DIM SHARED zone10 as n
DIM SHARED varC_result as C
heading_string = "Enter Rate per Zone"
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Enter Rate per Zone",""%dlg%
{region}
{text=55,1:heading_string};
{endregion};
{region}
Enter Account Number:| [.40Raccount];
Enter Type "Plt" , "Half" , "Item":| [.40Type];
Enter Number "1" "2" etc.:| [.40Items];
Enter price Zone 1:| [%z%.40Zone1];
Enter price Zone 2:| [%z%.40Zone2];
Enter price Zone 3:| [%z%.40zone3];
Enter price Zone 4:| [%z%.40zone4];
Enter price Zone 5:| [%z%.40Zone5];
Enter price Zone 6:| [%z%.40zone6];
Enter price Zone 7:| [%z%.40Zone7];
Enter price Zone 8:| [%z%.40Zone8];
Enter price Zone 9:| [%z%.40zone9];
Enter price Zone 10:| [%z%.40zone10];
{endregion};
{line=1,0};
{region}
"*15=ok_button_label!OK" "15=cancel_button_label!CANCEL"
{endregion};
%dlg%)
'tbl = table.open("ratetable|c:\alphawork\alphacons\ratetable.dbf")
query.filter = "account = raccount .and. type = type .and. items = items"
query.order = ""
query.options = ""
idex = tbl.query_create()
update.fields = 10
update.field1 = "rzone1"
update.expr1 = "var-"zone1"
update.field2 = "rzone2"
update.expr2 = "var-"zone2"
update.field3 = "rzone3"
update.expr3 = "var-"zone3"
update.field4 = "rzone4"
update.expr4 = "var-"zone4"
update.field5 = "rzone5"
update.expr5 = "var-"zone5"
update.field6 = "rzone6"
update.expr6 = "var-"zone6"
update.field7 = "rzone7"
update.expr7 = "var-"zone7"
update.field8 = "rzone8"
update.expr8 = "var-"zone8"
update.field9 = "rzone9"
update.expr9 = "var-"zone9"
update.field10 = "rzone10"
update.expr10 = "var-"zone10"
tbl.update()
Comment