NetTalk Central

Author Topic: Dynamic Content  (Read 4463 times)

Vic

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Dynamic Content
« on: November 19, 2012, 07:29:35 PM »
Bruce,

I have a couple of questions.

1. Is the Net:f:filename limited to a physical file on the \web folder? Or is it possible to use In-memory driver to make it more dynamic? such as I can enter on the Text property of a display field of a webForm something like '<-- Net:f:' & p_web.GetSessionValue('sessionfile') & ' -->' ?

2. I'm looking for a way to send html thru a field on a form via a websource, however, I want the html script to be dependent on a value of an SQL table field, Is there a way to do it?


Thanks,
Vic

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Dynamic Content
« Reply #1 on: November 19, 2012, 09:39:36 PM »
>> 1. Is the Net:f:filename limited to a physical file on the \web folder?

yes. the F tag is for files. And the files are always in web, or lower.

>> Or is it possible to use In-memory driver to make it more dynamic?

you can definitely use other tags to access data from a table. The most obvious is to use the name of a NetWebSource procedure which does whatever you like (including reading from a Memory table.)

>> such as I can enter on the Text property of a display field of a webForm something like '<-- Net:f:' & p_web.GetSessionValue('sessionfile') & ' -->' ?

Certainly you can generate your tags at runtime - you just need to get the right tag for what you are trying to do.

>> 2. I'm looking for a way to send html thru a field on a form via a websource, however, I want the html script to be dependent on a value of an SQL table field, Is there a way to do it?

sure, hand-code it in the netwebsource folder. ie open the table, read what you want, construct the html etc.
If you look at the generated source for a netwebsource it should be real easy (and obvious) of what to do.

cheers
Bruce


Vic

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Dynamic Content
« Reply #2 on: November 20, 2012, 09:19:52 PM »
Bruce,

Ok, Got it. However, the timer gets affected and stops auto updating.

Thanks,
Vic

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Dynamic Content
« Reply #3 on: November 20, 2012, 11:16:00 PM »
I think an example may help understand where you're at.

cheers
Bruce

Vic

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Dynamic Content
« Reply #4 on: November 21, 2012, 11:33:46 PM »
Bruce,

Below is a sample code. Option 1 will stop the update by timer, while Option 2 will auto update.

 SQLINQ{PROP:SQL}='SELECT RequestPending FROM TERMFILE Where Idle=2 AND DeviceNO=' & p_web.GetSessionValue('Ctr_No')

    NEXT(SQLINQ)
    IF NOT Errorcode()
        p_web.SetSessionValue('loc:Status',SQLI:F1)
        IF   p_web.GetSessionValue('loc:Status')=1
            p_web.SetSessionValue('SurveyStatus',1)

    option 1-> packet= '<table><tr>Please press <a href="Vterm_Select.htm?Status=1"> here to begin </a>' 

    option 2-> packet= '<table><tr>Please press START button to begin.</tr></table>'

       END
       Do Sendpacket
    END

Thanks,
Vic

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Dynamic Content
« Reply #5 on: November 22, 2012, 04:50:24 AM »
my guess is the timer is failing because your html is not xhtml compliant.
watch it in the Firebug console and see.

cheers
Bruce

Vic

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Dynamic Content
« Reply #6 on: November 22, 2012, 06:03:50 PM »
Bruce,

Will this technique of sending packets be limited to scripts related to  updating fields on the page or can I have it jump to another page?

Thanks,
Vic

Vic

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Dynamic Content
« Reply #7 on: November 22, 2012, 06:24:32 PM »
Bruce,

I finally got it to work using a NetWebSource procedure that I called from another websource. A direct packet send edited outside your xHTML container fails to compile with such error as misused '< >' or '{..}'  or literal too long.

Cheers,
Vic