NetTalk Central

Author Topic: Why does this code not work in a NetTalk webserver?  (Read 3451 times)

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Why does this code not work in a NetTalk webserver?
« on: December 22, 2012, 03:40:39 PM »
Hi All,

I have this code that runs fine in my windows app, but for some reason when it is called from a NetTalk webserver app it does some crazy stuff.  I am running this on an MSSQL backend, NetTalk 7, C8 9661.

This is the code

TCT:Guid=''
Set(TCT:TCTGUIDKey,TCT:TCTGUIDKey)
Loop
    IF Access:Ticket_Charge_Types.Next()
        BREAK
    END
    !Do Some stuff
END

The statement sent to SQL for the Ticket Charge types is this... notice the where clause.

SELECT GUID,R_TYPE,AUTOPOPULATE,AMOUNT,CANTDELETE,CANTEDIT,CHARGETYPE,PAYCOMMISSIONS,PROFITABILITY FROM TICKET_CHARGE_TYPES WHERE 0 = 1

I have this code on a dictionary trigger after Insert, and it gets the correct records from a normal clarion app, but when called from my nettalk web server app it gets no records.

Does anyone have ideas on how to resolve it?

Thanks!

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Why does this code not work in a NetTalk webserver?
« Reply #1 on: December 23, 2012, 03:16:10 AM »
Hi,

I have the same sort of problem when doing this operation on a TPS file.
Only difference is that I do an additional key-check.

recordkeyField = searchField
set(recordKey, recordKey)

loop until access:file.next() or recordKeyField <> searchField
   !Do some stuff
end

The key fits exactly, but no records are read at all.

Anyone??

Regards and merry Xmas
Rene Simons
Rene Simons
NT14.14

JPMacDonald

  • Full Member
  • ***
  • Posts: 106
    • View Profile
    • Email
Re: Why does this code not work in a NetTalk webserver?
« Reply #2 on: December 23, 2012, 12:17:46 PM »
Rene,

I have come across this and it is odd that in come cases your code will work and in others it does not, I cannot explain it.

It may work for you if you change the syntax to use the legacy style of coding:

OPEN(yourFile)
keyField = searchField
SET(recKey,RecKey)
LOOP
   NEXT(yourFile)
   IF Errorcode() THEN BREAK.
   IF reckeyField <> searchField THEN BREAK.
   !DO your stuff
END
CLOSE(yourFile)

CAUTION: If this works for you, test your app throughly, I tried and it worked but after a bit of use my app just hangs, not sure if its related to this code or not ;-(

Regards

Parker

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Why does this code not work in a NetTalk webserver?
« Reply #3 on: December 23, 2012, 09:19:41 PM »
Rene
If this is code called from inside a nettalk form then you need to explicitly open and close the tables you are using e.g
Access:Ticket_Charge_Types.Open()
Access:Ticket_Charge_Types.Usefile()
TCT:Guid=''
Set(TCT:TCTGUIDKey,TCT:TCTGUIDKey)
Loop UNTIL Access:Ticket_Charge_Types.Next()
        BREAK
    END
    !Do Some stuff
END
Access:Ticket_Charge_Types.Close()
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

estadok

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • EstaSoft
    • Email
Re: Why does this code not work in a NetTalk webserver?
« Reply #4 on: December 25, 2012, 03:34:41 AM »
Hi!

Also, shall use you (c) Yoda

{PROP:SQL} like:

p_web._OpenFile(Ticket_Charge_Types)
Ticket_Charge_Types{PROP:SQL} = 'select * from Ticket_Charge_Types where something = '&something or p_web.GSV('something')
NEXT(Ticket_Charge_Types)
Loop
      IF ERRORCODE() THEN  BREAK .
    !Do Some stuff
.
p_web._CloseFile(Ticket_Charge_Types)
« Last Edit: December 25, 2012, 03:37:44 AM by estadok »
Clarion 9.0.10376
NetTalk 7.26
SecWin 6.25
StringTheory 1.92