NetTalk Central

Author Topic: Local variable in NetWebBrowse - HELP  (Read 3915 times)

webwilcox

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Local variable in NetWebBrowse - HELP
« on: December 09, 2014, 06:25:05 PM »
Ok, I'm losing my mind on this one.  I have a NetWebBrowse procedure that is using a local variable called loc:ImageURL, I have the code to populate this variable in the Value::loc:ImageURL embed point (1 Start).  The code to fill the loc:ImageURL variable is :

URL:ItemNumber=clip(ITE:ItemNumber)
get(GLO:URLQueue, URL:ItemNumber)
if errorcode()
    loc:ImageURL='--'
ELSE
    loc:ImageURL=URL:URL
END

For reference, I have a URL list that is stored in a Global Queue.  I added a list box to the WebServer window to display the queue so I know that is values.  However, the loc:ImageURL column never has anything in it, not even the '--'.  It's almost like this code never runs. 

Am I in the wrong embed point?
What is the best embed point to set local variable for each row of a browse?

I'm using Clarion 9.1 and NT7

Here is the entire generated embed point

value::loc:ImageURL  Routine
  data
loc:extra      String(252)
loc:disabled   String(20)
loc:FormOk     Long(1)
loc:options    String(OptionsStringLen)  ! options for jQuery calls
loc:fieldClass String(252)
loc:javascript String(JavascriptStringLen)
loc:ok         Long
! Start of "Data section, where a Cell value is calculated"
! [Priority 5000]

! End of "Data section, where a Cell value is calculated"
  code
  ! Start of "Before a Cell value is calculated"
  ! [Priority 4000]
 
  URL:ItemNumber=clip(ITE:ItemNumber)
  get(GLO:URLQueue, URL:ItemNumber)
  if errorcode()
      loc:ImageURL='--'
  ELSE
      loc:ImageURL=URL:URL
  END
 
 
  ! End of "Before a Cell value is calculated"
    if false
    else ! default settings for column
      loc:extra = ''
      packet = clip(packet) & p_web.DivHeader('Auction_BrowseAllItems_loc:ImageURL_'&ITE:ItemNumber,,net:crc,,loc:extra)
      packet = clip(packet) &  p_web.CreateHyperLink(p_web._jsok(Left(Format(loc:ImageURL,'@s500')),(Net:HtmlOk*1)+(Net:UnsafeHtmlOk*1)),Choose(loc:formpopup = Net:Page,loc:ImageURL,choose(loc:formpopup=Net:Popup,'#','')),,p_web.combine(p_web.site.style.BrowseHyperlinks,),loc:javascript,,0,(Net:HtmlOk*1)+(Net:UnsafeHtmlOk*1),,)
    End
    packet = clip(packet) & p_web.DivFooter(Net:NoSend)
    ! Start of "After a Cell value is calculated"
    ! [Priority 5000]
   
    ! End of "After a Cell value is calculated"
    if loc:eip = 1
      do SendPacket
    end
! ----------------------------------------------------------------------------------------

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Local variable in NetWebBrowse - HELP
« Reply #1 on: December 09, 2014, 10:12:35 PM »
Hi Brad,

first off, your use of a global queue is not thread safe. In other words this line may run;

get(GLO:URLQueue, URL:ItemNumber)

and then some other thread may execute some code, perhaps also

get(GLO:URLQueue, URL:ItemNumber)

then your line;

 loc:ImageURL=URL:URL


Will get the value from the second GET, not the first.
So the use of Global queues is not recommended. (If you absolutely must use a Queue, use a critical section to "wrap" access to the queue, so only one thread can use it at a time.

A better choice would be a memory driver table.
And of course remember that multiple users will be sharing the same global space all at the same time.

Probably the easiest way to determine which part of the code is broken is by adding some trace statements;

  get(GLO:URLQueue, URL:ItemNumber)
  if errorcode()
      loc:ImageURL='--'
       p_web.trace('Setting Loc:ImageURL to ---')
  ELSE
      loc:ImageURL=URL:URL  ! <-- Is URl:Url in the Glo:UrlQueue?
       p_web.trace('Setting Loc:ImageURL to ' & loc:ImageURL)
  END


Cheers
Bruce

webwilcox

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Re: Local variable in NetWebBrowse - HELP
« Reply #2 on: December 10, 2014, 09:44:59 AM »
Thanks Bruce.  I'll move it to a Memory File.

Where can I see the output of the p_web.Trace method.  When I added those lines, I don't seen anything in the Webserver logging window.  Is there a log file I need to look at if I log to disk?

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Local variable in NetWebBrowse - HELP
« Reply #3 on: December 10, 2014, 10:16:04 AM »
Hi Brad
Download debugview and install it.
Run it and choose computer\connect
Before you run the procedure containing the trace make sure the debugview is on, it should give you a screen .
Any trace requests will appear on the screen.
Because any program will pass messages to debugview if they aren't stopped I normally choose edit/filter in debugview
and add a filter  [st]. This will only pass through string theory traces.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Local variable in NetWebBrowse - HELP
« Reply #4 on: December 10, 2014, 09:35:05 PM »
You can download Debugview from here;
http://technet.microsoft.com/en-us/sysinternals/bb842059

It's a very useful debugging tool, and pretty  much indispensable when building web apps.

cheers
Bruce