NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: jvillasenor on September 04, 2012, 08:14:38 AM

Title: Refresh Drop Field
Post by: jvillasenor on September 04, 2012, 08:14:38 AM
Hi All

I am new in NetTalk and am converting one of application to web, well Logon startup I'm stuck and use the following:

 Logon:       Field
 Password: Field
 Company: Drop Field

The Logon User is typed and is looking in one Table, this apparently works. DONE!

in this embed we get the User ID, and we ​​use:
  p_web.SetSessionValue ('F1: USER_ID', F1: USER_ID)
and i get the correct ID.

In the Drop I have a filter:
 'VIPR01: ALIAS_ID =' & p_web.GetSessionValue ('F1: USER_ID')

What's going on:

Upon entering the Logon Form, and I click on the Drop of Company are as many names as I have in the table users, why?

After entering the Logon, does not filter or where I have to tell you to do a refresh to Drop?

Many thxs

JM Villasenor
Cancun, Mexico
Title: Re: Refresh Drop Field
Post by: kevin plummer on September 04, 2012, 03:25:32 PM
> Upon entering the Logon Form, and I click on the Drop of Company are as many names as I have in the table users, why?

I'm not sure why, but if the filter fails it returns all records. I test all my filters in code for that very reason. So I add something like this in embed code:

If p_web.GetSessionValue ('F1: USER_ID') = 0
  loc:wasfilter = '1=2'
Else
  loc:wasfilter = 'VIPR01: ALIAS_ID =' & p_web.GetSessionValue ('F1: USER_ID')
End
Title: Re: Refresh Drop Field
Post by: jvillasenor on September 04, 2012, 05:06:09 PM
In which embed, i put the initial Filter in :
FIRMA_ALIAS = (Compoanies related)
Value Routine
  L:FILTER = ''VIPR01:ALIAS_ID =0'

in the start works fine, but when i get the User ID where i put the other embed.

Title: Re: Refresh Drop Field
Post by: kevin plummer on September 04, 2012, 06:49:48 PM
I usually just stick something like 'xxx' in the template filter  and then search for this in embed code and then pick the best embed point from there.
Title: Re: Refresh Drop Field
Post by: Pauly on September 05, 2012, 02:42:41 AM
HI,
Should there be a space in between 'F1:'  and 'USER_ID'
All through your examples there is, and surely that would cause unpredictable behaviour?

Pauly
Title: Re: Refresh Drop Field
Post by: Bruce on September 05, 2012, 03:50:13 AM
as long as it matched the place he set it, it will be ok.

ie - The space itself is not a problem. If the SessionValue name is not the same of course then there will be a problem.

cheers
Bruce

Title: Solution: Refresh Drop Field
Post by: jvillasenor on September 05, 2012, 08:36:42 AM
Hi All,

In this moment works as i want, i do the following:

Create a Local Variable (CSTRING 255) to handle the Drop Filter
In the Drop Field filter i put this local variable in this case L:FILTER

In the Drop Field -> 4 Valur Routine (5000) i put the following Embed
!----Drop Filter
IF p_web.GetSessionValue ('F1:USER_ID') = 0
   L:FILTER = 'VIPR01:ALIAS_ID=0'
 ELSE
   L:FILTER = 'VIPR01:ALIAS_ID='&p_web.GetSessionValue ('F1:USER_ID')
END

In the Logon Filed -> 3 ValidateValue Routine (5000)
Here i put a code to check our users then
DO refresh::DROP_FIELD

Works!!!

Title: Re: Refresh Drop Field
Post by: Bruce on September 05, 2012, 10:53:03 PM
Hi JM,

cool - glad you got it working. If you wanted to do the same thong without the local variable you can use the Choose statement.

Filter:
Choose( p_web.GetSessionValue ('F1:USER_ID') = 0, 'VIPR01:ALIAS_ID=0', 'VIPR01:ALIAS_ID='&p_web.GetSessionValue ('F1:USER_ID'))