NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Johan van Zyl on December 16, 2011, 05:21:45 AM
-
Hi
LOG table with and alias ALOG
BrowseStaffRequest
and a child on the browse i.e.
BrowseStaffAvailable
when you click on a row in StaffRequest all available staff rows must be shown in StaffAvailable
Filters
This works:
ALOG:TaskType = ''StaffAvailability'' and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
This does not
'ALOG:AvailableFromDate <= p_web.GetSessionValue(''LOG:DateRequired'') AND ALOG:AvailableToDate => p_web.GetSessionValue(''LOG:DateRequiredTo'') AND ALOG:TaskType = ''StaffAvailability'' and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
Where exactly must I put the filer? Under Default Filter of BrowseStaffAvailable
Thx!
-
Hi Johan,
The problem is the fact that you put the p_web stuff as text in the filter expression.
The filtering works the way: If the filter is wrong the filter will be ignored.
You have to concatenate the p_web.gsv values and the pext parts and create a string that looks like a proper expression.
Try This
'ALOG:AvailableFromDate <= ' & p_web.GSV('LOG:DateRequired') & ' AND ALOG:AvailableToDate >= ' & p_web.GSV('LOG:DateRequiredTo') & ' AND ALOG:TaskType = <39>StaffAvailability<39> and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
This should all fit in one line of code. You can use F10 when you type the filter in the filter field.
Mind the quotes and spaces.
Also replace p_web.GetSessionValue with p_web.gsv (less typing, more overview, less mistakes)
Cheers,
Rene
-
Thx Rene!
Still cannot get it to work though - see 2 attached files.
If you click on ASCOT PARK there must be 1 row for StaffAvailable - that still does not display.
if you click on blank Hospital Name there must be none.
-
Hi Johan,
Make the filter case insensitive. See the bold part in the filter string
'ALOG:AvailableFromDate <= ' & p_web.GSV('LOG:DateRequired') & ' AND ALOG:AvailableToDate >= ' & p_web.GSV('LOG:DateRequiredTo') & ' AND UPPER(ALOG:TaskType) = <39>STAFFAVAILABILITY<39> and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
Also
Go into the source and find where the filter is set. Look for LOC:FilterWas
In the first embed AFTER setting the filter, type: message(loc:filterwas) and run the app.
You'll see in the message what he filter string looks like.
Post it here if you can't figure it out.
Cheers,
Rene
P.s.
Bruce's NetTalk book has a very helpful chapter about filtering.
-
Cannot upload PNG
"The upload folder is full. Please try a smaller file and/or contact an administrator." ????
It is a very small PNG file - and how do I contact the administrator?
Hi
Still no luck.
Current filter:
'ALOG:AvailableFromDate <= ' & p_web.GSV('LOG:DateRequired') & ' AND ALOG:AvailableToDate >= ' & p_web.GSV('LOG:DateRequiredTo') & ' AND ALOG:TaskType = <39>StaffAvailability<39> and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
Message shows something like this:
ALOG:AvailableFromDate <= AND ALOG:AvailableToDate >= AND ALOG:TaskType = 'StaffAvailability and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0
(I cannot post the PNG of message here)
This on its own works - ALOG:TaskType = <39>StaffAvailability<39> - no need for UPPER in this case.
See attached for the filter in message.
The values from p_web.GSV does not show?
Source from StaffAvailableBrowse
ThisView{prop:order} = p_web.CleanFilter(ThisView,clip(loc:vorder))
loc:FilterWas = 'ALOG:AvailableFromDate <= ' & p_web.GSV('LOG:DateRequired') & ' AND ALOG:AvailableToDate >= ' & p_web.GSV('LOG:DateRequiredTo') & ' AND ALOG:TaskType = <39>StaffAvailability<39> and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
ThisView{prop:Filter} = loc:FilterWas
Loc:LocatorValue = p_web.GetLocatorValue(Loc:LocatorType,'StaffAvailable',Net:Both)
! Start of "Browse Filter"
! [Priority 5000]
!message(loc:filterwas) ! display message here?
! End of "Browse Filter"
loc:FilterWas = ThisView{prop:filter}
if loc:filterwas <> p_web.GetSessionValue('StaffAvailable_Filter')
p_web.SetSessionValue('StaffAvailable_FirstValue','')
p_web.SetSessionValue('StaffAvailable_Filter',loc:filterwas)
end
p_web._SetView(ThisView,ALog,ALOG:pk_log_lognumber,loc:PageRows,'StaffAvailable',left(Loc:LocateField),loc:FileLoading,loc:LocatorType,clip(loc:LocatorValue),Loc:SortDirection,loc:ViewOptions,Loc:FillBack,Loc:Direction,loc:NextDisabled,loc:PreviousDisabled,Loc:LocatorCase)
! Start of "After SetView"
! [Priority 5000]
message(loc:filterwas) ! or display message here?
Maybe p_web.SSV('LOG:DateRequired') p_web.SSV('LOG:DateRequiredTo') must be done in StaffRequestBrowse?
When you click on row in StaffRequestBrowse the filtered rows must be shown in StaffAvailableBrowse
when you first land on screen with 2 browses from menu choice will the hilited row (1st row by default) in StaffRequestBrowse trigger the filter - or only after selecting a certain row by clicking on it?
Thx!
-
Hi Johan,
I see no session value for LOG:DateRequired and LOG:DateRequiredTo.
Probably you assume that sessionvars are set automaticly.
As far as I know only primary file fields are set automaticly as session vars. The rest is up to you.
I figure that once youo get your session vars sorted out, the filterwillwork fine.
Cheers
Rene
-
Hi Rene/Bruce/Everyone
Still no luck
Here is filter from web app (F10 on filter field)
'ALOG:AvailableFromDate <= ' & p_web.GSV('LOG:DateRequiredFrom') & ' AND ALOG:AvailableToDate >= ' & p_web.GSV('LOG:DateRequiredTo') & ' AND ALOG:TaskType = <39>StaffAvailability<39> and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0'
Which does not work - no rows are shown.
(NOTE: I have renamed the field to LOG:DateRequiredFrom)
This is the filter in the Windows version of the app
ALOG:AvailableFromDate <= LOG:DateRequiredFrom and ALOG:AvailableToDate => LOG:DateRequiredTo AND ALOG:TaskType = 'StaffAvailability' and ALOG:HasBeenCompleted = 0 and ALOG:HasBeenCancelled = 0
and it works as expected.
therefore the
p_web.GSV('LOG:DateRequiredFrom') and p_web.GSV('LOG:DateRequiredTo') does not work
So "obviously" p_web.GSV must be done somewhere - for these 2?
Also- Must I set Hotfields anywhere?
[attachment deleted by admin]
-
>> p_web.GSV('LOG:DateRequiredFrom') and p_web.GSV('LOG:DateRequiredTo') does not work
more accurately, the method call to GSV is working, but the two fields do not contain any values.
>> So "obviously" p_web.GSV must be done somewhere - for these 2?
I think you mean p_web.SSV (SetSessionValue) must be done somewhere for these two.
I would agree with that.
Are you setting them somewhere?
cheers
Bruce
-
Oops - yes I meant SSV!
Where do I set them?
Tried a few places - nothing works.
[attachment deleted by admin]
-
"Where do I set them??"
I don't know.
As soon as you read the record concerned. you do a p_web.ssv('LOC:DateReuiredFrom',LOC:DateRequiredFrom) and the other one.
In case you only know the uniqque key for LOC, you might want to fetch that record first.
Rene
-
I have now put this in embed point
AfterBrowseRowClicked(StaffRequest)
p_web.ssv('LOG:DateRequiredFrom',LOG:DateRequiredFrom)
p_web.ssv('LOG:DateRequiredTo',LOG:DateRequiredTo)
Still does not work - at least it now shows ZEROs instead off nothing.
I don'y know what this means.
"In case you only know the uniqque key for LOC, you might want to fetch that record first."
I have a browse StaffRequest (LOG table) and a child called StaffAvailable (The alias of LOG called ALOG)
When I click on a row in StaffRequest it must filter StaffAvailable
-
Hi Johan,
The way I do it, and I don't know if it's the right way but it works:
In the routine where LOC:FilterWas is assigned, before the assigning of the filter string, embed:
LOC:<your key field> = p_web.gsv('LOC:<your key field')
p_web.ssv('LOC:RequiredDateFrom',0)
p_web.ssv('LOC:RequiredDateTo',0)
if ~access:LOC.fetch(<your key>)
p_web.ssv('LOC:RequiredDateFrom',LOC:RequiredDateFrom)
p_web.ssv('LOC:RequiredDateTo',LOC:RequiredDateTo)
end
See if this works. Make sure LOC is in the "other" file section.
Maybe Bruce knows a better solution.
Cheers,
Rene
-
embedding in the browse is a bad idea, because
a) the browse is not active when the form loads
b) while the "on click" will run, it'll do so asyncronously with the form loading, and the order is not guarenteed.
Also - your SSV will not work because the "clicked on record" is not loaded into the record buffer.
So embed in the form, probably the top of the GenerateForm routine is best.
you need to
open the parent file
load the parent record (the Unique ID fields are in the Value queue)
assign the session values
close the file.
Cheers
Bruce
-
:-)
-
This works - sort of!
In StaffAvailableBrowse
! %BeforeBrowseOptions
LOG:LogNumber = p_web.gsv('LOG:LogNumber')
p_web.ssv('LOC:RequiredDateFrom',0)
p_web.ssv('LOC:RequiredDateTo',0)
if ~access:LOG.fetch(LOG:pk_log_lognumber)
p_web.ssv('LOG:DateRequiredFrom',LOG:DateRequiredFrom)
p_web.ssv('LOG:DateRequiredTo',LOG:DateRequiredTo)
end
! it seems to require a NT version of ThisWindow.Reset(1)
! for now double-clicking on the row works
HELP!
Thx so far Bruce and Renee!