Results 1 to 15 of 15

Thread: GridEditUpdate & def=

  1. #1
    Join Date
    Jul 2004
    Posts
    39

    GridEditUpdate & def=

    I seem to be having problems with the GridEditUpdate and the default value not working. In regular edit/add modes, the def= works, but for some reason it isn't for the GridUpdate. In this NWind example I made some arbitrary field a radio button and defaulted it to 1 (True). When the screen loads, neither radio button are defaulted to. ANY IDEAS????

    ----------------------------------------------------------
    <script language="VB" runat="server">
    Sub Page_Load(Src As Object, E As EventArgs)
    'Field ordinals -> 0=OrderID; 1=CustomerID; 2=EmployeeID; 3=OrderDate; 4=RequiredDate; 5=ShippedDate;6=ShipVia;7=Freight
    Dim X As New tornado.z()
    X.dbQP = "U=1|S=15|M=Ty=Grid!SysInd=t|D=Nwind|ni=b5,upd ate, gridupdate|Q=Orders|Th=Title=Grid Edit| bm=orders;0+1|gdf=0,1,2,3,4,Freight"
    X.dbEditUPDATESQL = "(|UPDATE Orders SET Freight=[[7]] WHERE OrderID={{0}}"
    X.dbEditGridUPDATESQL = "(|UPDATE Orders SET OrderDate=#[[3]]#, RequiredDate=#[[4]]#, ShippedDate=#[[5]]# WHERE OrderID={{0}}"
    X.dbEditUpdateFlds = "fi=0|type=RONOUPDATE,Freight"
    X.dbEditGridUpdateFlds = "fi=0|type=RONOUPDATE,fi=OrderDate|type=radio|val= {{0-1}}|def=1,RequiredDate,ShippedDate"
    X.dbDebug = "EditSetup,EditAction"
    X.dbEditGridUpdate = True
    X.ASPdbNET()
    End Sub
    </script>

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    I ran the example and you are trying to set a date field to bool ?
    explain exactly what you are trying to do. You want to set default values of an update which does not make sense. Ma be Add and not Update.

    FK

  3. #3
    Join Date
    Oct 2002
    Posts
    933
    check the following to see whether it makes sense.... we'll set the shippeddate with a def = today...

    'Field ordinals -> 0=OrderID; 1=CustomerID; 2=EmployeeID; 3=OrderDate; 4=RequiredDate; 5=ShippedDate;6=ShipVia;7=Freight
    Dim X As New Tornado.z
    X.dbQP = "U=1|S=15|M=Ty=Grid!SysInd=t|D=Nwind|ni=b5,upd ate, gridupdate|Q=Orders|Th=Title=Grid Edit| bm=orders;0+1|gdf=0,1,2,3,4,5,Freight"
    X.dbEditUpdateSQL = "(|UPDATE Orders SET Freight=[[7]] WHERE OrderID={{0}}"
    X.dbEditGridUpdateSQL = "(|UPDATE Orders SET OrderDate=#[[3]]#, RequiredDate=#[[4]]#, ShippedDate=#[[5]]# WHERE OrderID={{0}}"
    X.dbEditUpdateFlds = "fi=0|type=RONOUPDATE,Freight,fi=ShippedDate|type= TEXT|def=Now()"
    X.dbEditGridUpdateFlds = "fi=0|type=RONOUPDATE,OrderDate,RequiredDate,fi=Sh ippedDate|type=TEXT|def=Now()"
    X.dbDebug = "EditSetup,EditAction"
    X.dbEditGridUpdate = True
    X.ASPdbNET()

  4. #4
    Join Date
    Jul 2004
    Posts
    39
    I was just using that date field as an example to show that the def= does not work for a bit field.

    I need the def=1 because I'm using as a 'lock record' mechanism that makes the record leave that particular user's desktop once it is locked.

    John M

  5. #5
    Join Date
    Oct 2002
    Posts
    933
    there is a 'discontinued' field in NWIND product table. See whether you can make a valid example out of it to show it breaks.

    FK

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    I got the Discontinued example going. Will check it a bit more and send to you...send me a private email so I can return.

    FK

  7. #7
    Join Date
    Jul 2004
    Posts
    39
    Frank, thanks for the help, but I just worked around it for now. I have another issue with GridEditUpdate and GridUpdate though.

    if you notice, gridupdate (mult update) has more fields listed than editupdate (single update), but when you execute, the same fields are listed.

    Any thoughts???

    Thanks
    John M

    see example below
    -------------------------------------------------------------
    <script language="VB" runat="server">
    Sub Page_Load(Src As Object, E As EventArgs)
    'Field ordinals -> 0=OrderID; 1=CustomerID; 2=EmployeeID; 3=OrderDate; 4=RequiredDate; 5=ShippedDate;6=ShipVia;7=Freight
    Dim X As New tornado.z()
    X.dbQP = "U=1|S=15|M=Ty=Grid!SysInd=t|D=Nwind|ni=b5,upd ate, gridupdate|Q=Orders|Th=Title=Grid Edit| bm=orders;0+1|gdf=0,1,2,3,4,Freight"
    X.dbEditUPDATESQL = "(|UPDATE Orders SET Freight=[[7]] WHERE OrderID={{0}}"
    X.dbEditGridUPDATESQL = "(|UPDATE Orders SET OrderDate=#[[3]]#, RequiredDate=#[[4]]#, ShippedDate=#[[5]]# WHERE OrderID={{0}}"
    X.dbEditUpdateFlds = "fi=0|type=RONOUPDATE,Freight"
    X.dbEditGridUpdateFlds = "fi=0|type=RONOUPDATE,fi=OrderDate|type=radio|val= { {0-1}}|def=1,RequiredDate,ShippedDate"
    X.dbDebug = "EditSetup,EditAction"
    X.dbEditGridUpdate = True
    X.ASPdbNET()
    End Sub
    </script>

  8. #8
    Join Date
    Oct 2002
    Posts
    933
    Need more explanation but first let's make the example a valid example so that we can see values being updated. Let's get rid o fthe radio box in a date field (unless it is a problem). Now, we have different fields in single and grid update (as a special feature requested by Paul some time agao).

    Fk


    'Field ordinals -> 0=OrderID; 1=CustomerID; 2=EmployeeID; 3=OrderDate; 4=RequiredDate; 5=ShippedDate;6=ShipVia;7=Freight
    Dim X As New Tornado.z
    X.dbQP = "U=1|S=15|M=Ty=Grid!SysInd=t|D=Nwind|ni=b5,upd ate, gridupdate|Q=Orders|Th=Title=Grid Edit| bm=orders;0+1|gdf=0,1,2,3,4,Freight"
    X.dbEditUpdateSQL = "(|UPDATE Orders SET Freight=[[7]] WHERE OrderID={{0}}"
    X.dbEditGridUpdateSQL = "(|UPDATE Orders SET OrderDate=#[[3]]#, RequiredDate=#[[4]]#, ShippedDate=#[[5]]# WHERE OrderID={{0}}"
    X.dbEditUpdateFlds = "fi=0|type=RONOUPDATE,Freight"
    X.dbEditGridUpdateFlds = "fi=0|type=RONOUPDATE,fi=OrderDate,RequiredDate,Sh ippedDate"
    X.dbDebug = "EditSetup,EditAction"
    X.dbEditGridUpdate = True
    X.ASPdbNET()

  9. #9
    Join Date
    Oct 2002
    Posts
    933
    Did you get the Boolean field edit with default values example. Seems like you have problems in this area. Below is the code. When you deal with a boolean field, you should use a checkbox and not a radio. This example is very good and I added that to the code gallery -

    Dim Ed As New Tornado.z
    With Ed
    .dbQP = "U=1|S=10|M=G!sys=t!Rowedit=t|D=NWIND|Q=Products|g df=0,1,2,discontinued|" _
    & "Bm=products;0|Ni=b5,Update,GridUpdate,Add,GridAdd |egu=t|ega=t|Th=Ti=Normal & Grid Edit"
    .dbEditAddFlds = "1, fi=Discontinued|Ty=CB|Def=t"
    .dbEditGridAddFlds = "1, 2, fi=Discontinued|Ty=CB|Def=f"
    .dbEditUpdateFlds = "fi=0|Ty=RONOUP, 1, fi=Discontinued|Ty=CB|Def=t"
    .dbEditGridUpdateFlds = "fi=0|Ty=RONOUP, fi=Discontinued|Ty=CB|Def=f"
    .ASPdbNET()
    End With
    Last edited by Frank; 08-10-2005 at 10:33 AM.

  10. #10
    Join Date
    Jul 2004
    Posts
    39
    Forget about the discontinued subject... I already worked around that. I am having a conflict with the EditGridUpdateFlds and the EditUpdateFlds.

    If you see the example that you sent back to me, you will notice that when you click "Grid Update" and "Update" you get the same listed fields, however in the code it has different fields.


    --------------------------------
    X.dbEditUpdateFlds = "fi=0|type=RONOUPDATE,Freight"
    -- 2 Fields

    --------------------------------
    X.dbEditGridUpdateFlds = "fi=0|type=RONOUPDATE,fi=OrderDate,RequiredDate,Sh i ppedDate"
    --4 Fields


    Please run Nwind example and get back to me

    Thanks
    John M

  11. #11
    Join Date
    Oct 2002
    Posts
    933
    No, I do not see the same edit SQL in edit and gridedit.... let me send you the DLL I have and sync on that first...

  12. #12
    Join Date
    Jul 2004
    Posts
    39
    OK Thanks

    John M

  13. #13
    Join Date
    Jul 2004
    Posts
    39
    Problem resolved.... Thank You... I started to think I was going crazy.

    John M

  14. #14
    Join Date
    Oct 2002
    Posts
    933
    Please state the problem solving tehnique if it would help other users. I do not think you are going crazy. You are just into the applications details. But if you take one step back and look at your code, you'll find out that it is a lot lot less then those made by your associates using VS.Net, Cold Fusion etc.. (Pardon A bit of advertising here).

    The reason we are doing this way is that it is fun to solve this kind of problems especially we can make is a standard case so the next time user do it, it'll be a feature instead. The separate normal and grid edit Paul recommended breaks a lot of code and finally we got it made and it is a good one.


    Frank

  15. #15
    Join Date
    Jul 2004
    Posts
    39
    That code that you sent works perfectly. (see below)

    ----------------------------
    Dim Ed As New Tornado.z
    With Ed
    .dbQP = "U=1|S=10|M=G!sys=t!Rowedit=t|D=NWIND|Q=Products|g d f=0,1,2,discontinued|" _
    & "Bm=products;0|Ni=b5,Update,GridUpdate,Add,GridAdd | egu=t|ega=t|Th=Ti=Normal & Grid Edit"
    .dbEditAddFlds = "1, fi=Discontinued|Ty=CB|Def=t"
    .dbEditGridAddFlds = "1, 2, fi=Discontinued|Ty=CB|Def=f"
    .dbEditUpdateFlds = "fi=0|Ty=RONOUP, 1, fi=Discontinued|Ty=CB|Def=t"
    .dbEditGridUpdateFlds = "fi=0|Ty=RONOUP, fi=Discontinued|Ty=CB|Def=f"
    .ASPdbNET()
    End With

    ------------------

    Using a radio button in this case really doesn't make any sense... and if I can default to True or False, it works for me.

    Thanks Again,
    John M

Posting Permissions

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