New call-to-action
Results 1 to 3 of 3

Thread: table update()

  1. #1
    VAR
    Real Name
    Andy Meer
    Join Date
    Mar 2005
    Location
    Atherstone UK
    Posts
    459

    Default table update()

    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()

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: table update()

    update.expr1 = "if(var-"zone1"0,var-"zone1,rzone1)"

    etc....

  3. #3
    VAR
    Real Name
    Andy Meer
    Join Date
    Mar 2005
    Location
    Atherstone UK
    Posts
    459

    Default RE: table update()

    Hi Stan

    Thanks again

    Andy

Similar Threads

  1. update a child table
    By dik_coleman in forum Alpha Five Version 6
    Replies: 10
    Last Post: 10-09-2004, 02:45 PM
  2. How to update table
    By RupertP in forum Alpha Five Version 5
    Replies: 6
    Last Post: 11-21-2002, 03:55 AM
  3. Update records while table in use?
    By Daniel Weiss in forum Alpha Five Version 4
    Replies: 3
    Last Post: 06-20-2001, 01:03 PM
  4. Scrolling Screen query table and update table
    By mpierce in forum Alpha Five Version 4
    Replies: 2
    Last Post: 09-21-2000, 08:38 AM
  5. How do I update a table
    By Mike Reed in forum Alpha Five Version 4
    Replies: 5
    Last Post: 07-21-2000, 01:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •