NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Poul Jensen

Pages: [1] 2 3 ... 17
1
Web Server - Ask For Help / Re: Call a related table update form
« on: May 17, 2025, 07:25:08 AM »
Hi Ron,

Thanks - that got me going.
Had an issue still getting an Record Not Found error when loading form B, until I added this code in the InitForm Routine:

Code: [Select]
p_web.SetValue('MCus:CUSTOMERNO',p_web.GSV('MCus:CUSTOMERNO'))
/Poul

2
Hi,

From a button on the update form of table A, I would like to call the update form of a related table B.
On the button > Client-Side > Send new value to server, I get the record of the related table B (and verifies with debugview++ that it is the correct record) but I have no luck with calling the related update form.

Have tried various variants of code hacked from table B's browse, but without success.  See code below:

Code: [Select]
    DO OpenFiles
    !Get record of table A
    Access:MobSagH.ClearKey(MSagH:KeyGUID)
    MSagH:GUID =  p_web.GSV('MSagH:GUID')
    NOMEMO(MobSagH)
    IF Access:MobSagH.TryFetch(MSagH:KeyGUID)
        !failed
    ELSE
        !Get record of table B
        Access:MobCustomers.ClearKey(MCus:KeyGUID)
        MCus:GUID =  MSagH:KundeGUID
        NOMEMO(MobCustomers)
        IF Access:MobCustomers.TryFetch(MCus:KeyGUID)
            !failed
        ELSE
            ds_outputdebugstring('RET KUNDEN - **OK**  MSagH:KundeGUID: ' & MSagH:KundeGUID)
            p_web.SSV('MCus:CUSTOMERNO', MCus:CUSTOMERNO)       

            !This doesn't work
            UpdateMobCustomers(p_web,Net:Web:Popup)  !Form Procedure
                   
        END
    END
    DO CloseFiles

What am I missing here?

tia
/Poul

3
try
    p_web.HeaderDetails.ContentDisposition =  'attachment; filename="'& CLIP(Loc:DownloadFileName) &'"'
    p_web.HeaderDetails.CacheControl = 'no-store, no-cache, must-revalidate, private,post-check=0, pre-check=0, max-age=0'


Thanks Bruce - this did it.

/Poul

4
Web Server - Ask For Help / Re: How to set file upload filetypes
« on: May 12, 2025, 12:52:12 AM »
Thanks.

The field "Custom" did it.

/Poul

5
Hi,

Using this to download a file:
Code: [Select]
p_web.HeaderDetails.ContentDisposition =  'attachment; filename="'& CLIP(Loc:DownloadFileName) &'"'
Works fine first time, but if user later downloads same file, it is being served from internet browsers cache, and therefore not the latest version af the file.

How can I avoid this?

tia
/Poul

6
Hi,

Where do I set the filetypes for the filepicker used in the File Upload on a NT form?

tia
/Poul

7
OK.

But with data tables, the threaded connection strings you use need to be set on each thread.  Hence the suggestion to set them in ProcessLink each time a thread runs.

My point was that once you set a theme, you do not need to set it again each thread.  It's sticky to the session, not to a thread. 

That said, the one time that you set the theme can be with the rest of the stuff you're doing in ProcessLink - no need to have separate code to do it in PageHeaderTag.
Set the theme once in ProcessLink, and set the threaded connection strings there each time.

Noted.

Thanks for your comments.

8
Web Server - Ask For Help / Re: Changing theme has no effect
« on: April 19, 2025, 01:32:57 AM »
I think I have a solution now  ;D

In Webhandler - ProcessLink this code:
Code: [Select]
   !ANY PARAMETER?   IF NOT DEFAULTS TO '1', BUT ONLY IF p_web.GSV('CommandA') IS NOT SET:
    p_web.SSV('ChangeTheme', '0')
    IF p_web.GetValue('a') <> ''
        p_web.SetValue('CommandA', p_web.GetValue('a'))
        p_web.SSV('CommandA', p_web.GetValue('a'))
       
        !LOGS OUT
        p_web.SSV('Med_Init', '')
        p_web.SSV('Med_Navn', '')
        p_web.SSV('Med_Email', '')       
        p_web.SetSessionLoggedIn(0)
        p_web.SSV('ChangeTheme','1')
    ELSE
        IF p_web.GSV('CommandA') = '' 
            p_web.SetValue('CommandA','1')
            p_web.SSV('CommandA', '1')
            p_web.SSV('ChangeTheme', '1')
        END   
    END

    ds_outputdebugstring( 'Webhandler Processlink - p_web.GSV(CommandA) 2: ' & p_web.GSV('CommandA') )

    !SETTING THE DATAPATH - A FOLDER OFF THE STATIC PATH IN GLO:StellarProgSti
    GLO:RegnskabsNummer =  p_web.GSV('CommandA')
    p_web.SSV('GLO:RegnskabsNummer', GLO:RegnskabsNummer)
    GLO:DataSti =  CLIP(GLO:StellarProgSti) & '\' & p_web.GSV('CommandA')
    p_web.SSV('GLO:DataSti', GLO:DataSti)   
    p_web.SSV('DataPath', p_web.GSV('GLO:DataSti'))
       
    ds_outputdebugstring('Webhandler Processlink - GLO:DataSti: ' & p_web.GSV('DataPath'))

    IF EXISTS( GLO:DataSti )       
        GLO:Inifil =  clip(GLO:DataSti) & '\MobilService.ini'
        p_web.SSV('GLO:Inifil', GLO:Inifil) 
       
        include('\pstellar_filename_defs_Slim.inc')    !THIS IS WHERE THE FILENAMES ARE BUILD
           
        !GETTING CUSTOMER NAME FROM INI
        g:KundeNavn =  GETINI('KundeProg','Kundenavn_' & p_web.GSV('CommandA') ,'' , clip(path()) & '\KundeProg.ini')
        IF CLIP(g:KundeNavn) = ''
            !GRABS DEFAUL:
            g:KundeNavn =  GETINI('KundeProg','Kundenavn' ,'' , clip(path()) & '\KundeProg.ini')
        END
        p_web.SSV('Kundenavn', g:KundeNavn)
       
        !GETTING THEME FROM INI
        GloTheme =  GETINI('KundeProg','Theme_' & p_web.GSV('CommandA') ,'redmond', clip(path()) & '\KundeProg.ini')   
        p_web.SSV('theme', GloTheme )
       
        ds_outputdebugstring('Webhandler Processlink - GloTheme: ' & CLIP(GloTheme))           
       
    ELSE
        p_web.showInfo('ERROR IN PARAMETER.....')
        ds_outputdebugstring('Webhandler Processlink  - Path does not exist: ' & CLIP(GLO:DataSti) )
       
        !AND SETS DEFAULT
        p_web.SSV('CommandA', '1')   
    END

and in PageHeaderTag - Processed Code this:
Code: [Select]
    IF p_web.GSV('ChangeTheme') = '1' AND p_web.GSV('theme') <> ''

        ds_outputdebugstring('In PageHeaderTag - p_web.GSV(theme): ' & p_web.GSV('CommandA') & ' - ' & p_web.GSV('theme') )
        p_web.ChangeTheme( p_web.GSV('theme') )
        p_web.SSV('ChangeTheme', '0')
           
    END


9
Web Server - Ask For Help / Re: Changing theme has no effect
« on: April 18, 2025, 10:18:53 PM »
Hi Jane,

I really would like to set the theme as early as possible, and with static dataset this is easy.
As I understand it, with multiple datasets the Webhandler - Processlink is the best place to set the users dataset, and this works fine now.
And here I also read the user theme.
See the code below.

I will see if I can make it to the Thursday webinar.

Webhandler - Processlink:
Code: [Select]
    ds_outputdebugstring( 'Webhandler Processlink - p_web.GetValue(a) 1: ' & p_web.GetValue('a') )
    ds_outputdebugstring( 'Webhandler Processlink - p_web.GSV(CommandA) 1: ' & p_web.GSV('CommandA') )

   !ANY PARAMETER?   IF NOT DEFAULTS TO '1', BUT ONLY IF p_web.GSV('CommandA') IS NOT SET:
    IF p_web.GetValue('a') <> ''
        p_web.SetValue('CommandA', p_web.GetValue('a'))
        p_web.SSV('CommandA', p_web.GetValue('a'))
       
        !LOGS OUT
        p_web.SSV('Med_Init', '')
        p_web.SSV('Med_Navn', '')
        p_web.SSV('Med_Email', '')       
        p_web.SetSessionLoggedIn(0)
    ELSE
        IF p_web.GSV('CommandA') = '' 
            p_web.SetValue('CommandA','1')
            p_web.SSV('CommandA', '1')
        END   
    END

    ds_outputdebugstring( 'Webhandler Processlink - p_web.GSV(CommandA) 2: ' & p_web.GSV('CommandA') )

    !SETTING THE DATAPATH - A FOLDER OFF THE STATIC PATH IN GLO:StellarProgSti
    GLO:RegnskabsNummer =  p_web.GSV('CommandA')
    p_web.SSV('GLO:RegnskabsNummer', GLO:RegnskabsNummer)
    GLO:DataSti =  CLIP(GLO:StellarProgSti) & '\' & p_web.GSV('CommandA')
    p_web.SSV('GLO:DataSti', GLO:DataSti)   
    p_web.SSV('DataPath', p_web.GSV('GLO:DataSti'))
       
    ds_outputdebugstring('Webhandler Processlink - GLO:DataSti: ' & p_web.GSV('DataPath'))

    IF EXISTS( GLO:DataSti )       
        GLO:Inifil =  clip(GLO:DataSti) & '\MobilService.ini'
        p_web.SSV('GLO:Inifil', GLO:Inifil) 
       
        include('\pstellar_filename_defs_Slim.inc')    !THIS IS WHERE THE FILENAMES ARE BUILD
           
        !GETTING CUSTOMER NAME FROM INI
        g:KundeNavn =  GETINI('KundeProg','Kundenavn_' & p_web.GSV('CommandA') ,'' , clip(path()) & '\KundeProg.ini')
        IF CLIP(g:KundeNavn) = ''
            !GRABS DEFAULT:
            g:KundeNavn =  GETINI('KundeProg','Kundenavn' ,'' , clip(path()) & '\KundeProg.ini')
        END
        p_web.SSV('Kundenavn', g:KundeNavn)
       
        !GETTING THEME FROM INI
        GloTheme =  GETINI('KundeProg','Theme_' & p_web.GSV('CommandA') ,'redmond', clip(path()) & '\KundeProg.ini')   
        p_web.SSV('theme', GloTheme )
       
        ds_outputdebugstring('Webhandler Processlink - GloTheme: ' & CLIP(GloTheme))           
       
    ELSE
        p_web.showInfo('ERROR IN PARAMETER.....')
        ds_outputdebugstring('Webhandler Processlink  - Path does not exist: ' & CLIP(GLO:DataSti) )
       
        !AND SETS DEFAULT
        p_web.SSV('CommandA', '1')   
    END


Webhandler - ParseRequestHeader:
Code: [Select]
!CALLING ONE OR THE OTHER - BUT SINCE THEY ARE CLEARED, NO CHANGETHEME HAPPENS:

!ds_outputdebugstring('In ParseRequestHeader - p_web.GSV(theme): ' & p_web.GSV('CommandA') & ' - ' & p_web.GSV('theme') )
!IF CLIP(p_web.GSV('theme')) <> ''
!    self.ChangeTheme( p_web.GSV('theme') )
!END

ds_outputdebugstring('In ParseRequestHeader - GloTheme: ' & p_web.GSV('CommandA') & ' - ' & CLIP(GloTheme ))
IF CLIP(GloTheme) <> ''
    self.ChangeTheme( CLIP(GloTheme ))
END

10
Web Server - Ask For Help / Re: Changing theme has no effect
« on: April 18, 2025, 12:25:22 AM »
My initial description is incomplete.
I actually read the individual users dataset and thus their selected theme in Webhandler - Processlink, and set the GloTheme accordingly.

But in Webhandler - ParseRequestHeader those variables are empty, no matter if I use
self.ChangeTheme( GloTheme )
or
self.ChangeTheme( p_web.GSV('theme') )

I am confused....

/Poul

11
Web Server - Ask For Help / Changing theme has no effect (SOLVED)
« on: April 17, 2025, 02:27:20 AM »
In Webhandler - ParseRequestHeader I have:

Code: [Select]
GloTheme =  GETINI('KundeProg','Theme_' & p_web.GSV('CommandA') ,'redmond', clip(path()) & '\KundeProg.ini')
ds_outputdebugstring('In ParseRequestHeader - GloTheme: ' & GloTheme )

self.ChangeTheme( GloTheme )

but no change in theme is being done.
I have verified that the correct theme is picked from the ini-file.

Any hints?

tia
/Poul


12
Web Server - Ask For Help / Re: Pass parameter in servercall?
« on: April 17, 2025, 12:32:39 AM »
p_web.StoreValue('a')
Is the best way to set a session value to a value, because then if the value doesn't exist (as a parameter) it does not overwrite the session value.
I expect you are just overwriting your session value to blank when the value does not exist.

Thanks Bruce - spot on.

13
Web Server - Ask For Help / Re: Pass parameter in servercall?
« on: April 17, 2025, 12:32:03 AM »
You'll need to set your filename variables EACH TIME your code runs through p_web.ProcessLink in the webhandler (because each pass through there is happening on a new thread), so set the session values the first time (when they're sent as parameters) then use those session values to set the filename variables EACH TIME.

That was the missing piece :-)

Thanks Jane.

14
Web Server - Ask For Help / Re: Pass parameter in servercall?
« on: April 15, 2025, 10:43:24 PM »
Hi Alberto,

That is what I am using, but at soon as I click the button for the login window, the filename variables are being reset.

Cheers
/Poul

15
Web Server - Ask For Help / Re: Pass parameter in servercall?
« on: April 15, 2025, 08:21:01 AM »
Let me expand on this:

What I want to achieve, is to call the app with a parameter, read this parameter and change the filenames global variable names, so they point to a specific dataset.
As per the docs re Multiple Data Sets:  https://www.capesoft.com/docs/NetTalk14/NetTalkWebBasic.htm#MultipleDataSets, I have tried the webhandler RequestHostSet embed to read the parameter and save it in a session variable.

But next time through the webhandler this is being reset.

So I need some guidance here for the best approach.

tia

/Poul

Pages: [1] 2 3 ... 17