NetTalk Central

Author Topic: NetWebForm update  (Read 3521 times)

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
NetWebForm update
« on: March 10, 2015, 08:26:29 PM »
I have problem with update record after form. I have table (NetWebBrowse) with records but when I call update procedure it opens with my actual record and when I change anything it closed silently but record is not updated. Everything remains as it was.

I used new method p_web.WatchSessionValue('ZHP:RobID') and it shows me that my variable is changed and never gets old value so I would like to know where is moment when NetWebForm writeq record to disk.
Where is exact instruction for disk writing?
I found that there is a method p_web.updatefile but it is not called in procedure or any other procedure in program so I am puzzled.

Best regards,

Djole

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebForm update
« Reply #1 on: March 10, 2015, 10:06:52 PM »
Hi Djordje,

>> I found that there is a method p_web.updatefile but it is not called in procedure or any other procedure in program so I am puzzled.

it's called from SaveForm method in the netweb.clw

I'm not sure why your form is not changing - does this happen everywhere, or just in this one case?

cheers
Bruce

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: NetWebForm update
« Reply #2 on: March 10, 2015, 11:27:55 PM »
Good.

Now where on earth is call for SaveForm? I tried with grep to find it in my source but nothing popup.

This application has only three real forms. Two of them are problematic but not in a same way.
Second problematic procedure does not show some of data in a form but it is next on a list to repair
and I hope that I will not ask for help.

Regards,

Djole
« Last Edit: March 11, 2015, 03:59:14 AM by Bruce »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebForm update
« Reply #3 on: March 11, 2015, 03:58:43 AM »
>> Now where on earth is call for saveForm?

if you search around inside netweb.clw you'll see the whole process.
It starts with the .ProcessRequest method - makes it's way to .ProcessLink, and then various methods from there depending on the form action.

Keep an eye on WebHandler as well because a fair bit of code is generated into that as well.

cheers
Bruce

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: NetWebForm update
« Reply #4 on: March 11, 2015, 06:42:01 AM »
Thank you Bruce for your support.

I finally sort it out. Cause I did not find the way to determine content of fields in p_file (parameter of SaveForm),
I added new method to your NetWebServerWorker and it dump fields of requested file to dump file. This procedure may be improved a lot but it done job for me. I will put it in the end of this message and if you find it useful you may it include it in NetWeb class. This procedure is a modified procedure from Clarion help file

Best regards,
Djole

NetWebServerWorker.File2TXT PROCEDURE  (*FILE pGrp)               ! Declare Procedure

                    MAP
DumpGroupDetails      PROCEDURE(USHORT start, USHORT total)
DumpFieldDetails      PROCEDURE(USHORT indent, USHORT FieldNo)
SetAttribute          PROCEDURE(SIGNED Prop,STRING Value)
StartLine             PROCEDURE(USHORT indent,STRING label, STRING type)
Concat                PROCEDURE(STRING s)
AddLineNo             PROCEDURE
                    END

LineSize                EQUATE(255)
FileIndent              EQUATE(2)

TheFile                 &FILE
FileLabel               STRING(30)

FlKey                    &KEY
Line                    STRING(LineSize)
FullText                STRING(16384)
Blobs                   LONG
St                      StringTheory
FldPtr                  ANY
Prefix                  STRING(10)
LENPre                        SHORT
Sl                            StringTheory
LineNo                        LONG


  CODE
    LineNo = 0
    TheFile &= pGrp
    Sl.SetValue('')
    AddLineNo
    Sl.AddLine(LineNo,'File:'&TheFile{PROP:Name})
    Prefix = TheFile{PROP:Label,1}
    LENPre = INSTRING(':', Prefix, -1, LEN(CLIP(Prefix)))
    IF LENPre
      Prefix = Sub(Prefix,1,LENPre)
    END   
    AddLineNo
    Sl.AddLine(LineNo,'PREFIX:'&Prefix)
    DO DumpMemosBlobs
    AddLineNo
    Sl.AddLine(LineNo,'RECORD')
    DumpGroupDetails(0, TheFile{PROP:Fields})
    Sl.AddLine(LineNo,'END RECORD')
    sl.Join('<13,10>')
    Sl.SaveFile('DUMPRECS.TXT',1)
   
    Return !St.GetVal()
   
 
DumpMemosBlobs ROUTINE
DATA
x UNSIGNED,AUTO
TypeMemo  STRING(20)
CODE
  LOOP X = 1 TO (TheFile{PROP:Memos} + TheFile{PROP:Blobs})
    AddLineNo
    Sl.AddLine(LineNo,'BLOB_MEMO '&Clip(X))
    IF UPPER (TheFile{PROP:type, -X}) = 'MEMO'
      TypeMemo = 'MEMO('&CLIP(TheFile{PROP:Size, -X})&')'
    ELSE
      TypeMemo = 'BLOB'
    END
    AddLineNo
    Sl.AddLine(LineNo,'Type:'&TypeMemo)
   END
   
DumpGroupDetails    PROCEDURE(USHORT start, USHORT total)
fld                   USHORT
fieldsInGroup         USHORT
GroupIndent           USHORT,STATIC,AUTO
GrpName               STRING(20)

  CODE
    GroupIndent += 2
    LOOP fld = start+1 TO start+total
      DumpFieldDetails(GroupIndent,fld)
      IF TheFile{PROP:Type,fld} = 'GROUP'
        GrpName = TheFile{PROP:Label,fld}
        GrpName = GrpName[LenPre + 1 : LEN(CLIP(GrpName))]
        AddLineNo
        Sl.AddLine(LineNo,'GROUP:'&Clip(GrpName))
        fieldsInGroup = TheFile{PROP:Fields,fld}
        DumpGroupDetails (fld, fieldsInGroup)
        AddLineNo
        Sl.AddLine(LineNo,'END GROUP')
        fld += fieldsInGroup
      END
    END
    GroupIndent -= 2

 
DumpFieldDetails    PROCEDURE(USHORT indent, USHORT FieldNo)
FldType               STRING(20)
FldPicture            STRING(50)
FldSize               STRING(20)
FldDIM                STRING(20)
FldOver               STRING(20)
FlVal                 ANY
grp                   &GROUP
DecPlac               BYTE
Pict                  STRING(20)
FldName               STRING(40)
lp                    String(80)
  CODE
    grp &= pGrp{PROP:Record}
    FldType = TheFile{PROP:Type,FieldNo}
    AddLineNo
    Sl.AddLine(LineNo,'FIELD')
    FldName = TheFile{PROP:Label,FieldNo}
    FldName = FldName[LenPre + 1 : LEN(CLIP(FldName))]
    AddLineNo
    Sl.AddLine(LineNo,'Name:'&FldName)
    StartLine(indent,FldType,'')
    IF INSTRING('STRING', FldType, 1, 1)
      Concat('(')
      IF TheFile{PROP:Picture, FieldNo}
        Concat(TheFile{PROP:Picture, FieldNo})
      ELSE
        Concat(TheFile{PROP:Size, FieldNo})
      END
      Concat(')')
    ELSIF INSTRING('DECIMAL', FldType, 1, 1) OR INSTRING('PDECIMAL', FldType, 1,1)
      Concat('(' & TheFile{PROP:Size, FieldNo} & ',' & |
        TheFile{PROP:Places, FieldNo} & ')')
      DecPlac = TheFile{PROP:Places, FieldNo}
    END
 
    IF TheFile{PROP:Dim,FieldNo} <> 0
      Concat(',DIM(' & CLIP(TheFile{PROP:Dim,FieldNo}) & ')')
    END
    IF TheFile{PROP:Over, FieldNo} <> 0
      Concat(',OVER(')
      IF TheFile{PROP:Label, TheFile{PROP:Over, FieldNo}}
        Concat(CLIP(TheFile{PROP:Label, TheFile{PROP:Over, FieldNo}}))
      ELSE
        Concat('field ' & TheFile{PROP:Over, FieldNo})
      END
      Concat(')')
    END
    AddLineNo
    Sl.AddLine(LineNo,'Type:'&Clip(LINE))
    FlVal = What(grp,FieldNo)
    if  TheFile{PROP:Picture, FieldNo}
      Pict = TheFile{PROP:Picture, FieldNo}
      AddLineNo
      Sl.AddLine(LineNo,'Value:'&Format(FlVal,Pict))
    ELSE   
      CASE FldType
        of 'DATE'
          AddLineNo
          Sl.AddLine(LineNo,'Value:'&Format(FlVal,@d06.b))
        of 'TIME'
          AddLineNo
          Sl.AddLine(LineNo,'Value:'&Format(FlVal,@t04b))
        of 'DECIMAL'
        orof 'PDECIMAL'
          Pict = '@-n12.'&Clip(DecPlac)
          FldName = Clip(FlVal)
          AddLineNo
          Sl.AddLine(LineNo,'Value:'&FldName)   
        ELSE
          AddLineNo
          Sl.AddLine(LineNo,'Value:'&Clip(FlVal))
      END             
    END
     
    AddLineNo
    Sl.AddLine(LineNo,'END FIELD')
 
SetAttribute        PROCEDURE (Prop,Value)
  CODE
    IF Prop THEN Line = CLIP(Line) & ',' & CLIP(Value).
 
StartLine           PROCEDURE (USHORT indent,STRING label, STRING type)
spaces                USHORT,AUTO
clen                  LONG,AUTO
 
  CODE
    line = label
    clen = LEN(CLIP(line))
    IF  clen < Indent
      spaces = Indent - clen
    ELSE
      spaces = 4
    END
    line = CLIP(line) & ALL(' ', spaces) & type
 
Concat              PROCEDURE (STRING s)
  CODE
    Line = CLIP(Line) & s
 
AddLineNo           PROCEDURE
  CODE
    LineNo += 1