Step 2. Add List Paging Images weblet

WAM065 - Controlling List Output

1.  In the Design view, click anywhere in the employee list and use the context menu, Table Items / Add Rows… to add one row to the bottom of this table.

     Hint: Click in one of the columns such as Given Name and then use the context menu.

2.  Select inside the left hand cell of this new row and use the Details tab to set its colspan to 5.

3.  Drag a List paging images weblet into the new row. Your web page should look like the following:

4.  Save your changes.

5.  Select the list paging images weblet and use the Details tab to set up its properties:














     You will observe that STDPREV, STDMORE and STDRENTRY are already defined. All these fields are defined in the repository. To use this weblet you must ensure they are mapped appropriately.

     The WebRoutine page is not yet defined, so you must type in this value.

6.  Save your changes.

You'll find a detailed definition of all weblets in the Web Application Modules guide.

STDPREV and STDMORE are used to show or hide the next and previous images. STDPREV = Y will hide the previous image.

The weblet returns a value in STDRENTRY when the more or previous image is selected.

7.  Add STDPREV and STDMORE as hidden fields in the global web_map, which should now look like the following:

* Global Maps

Web_Map For(*both) Fields((#stdrentry *hidden) (#empnof *hidden) (#empnow *hidden) (#cur_page *hidden) (#stdmore *hidden) (#stdprev *hidden))

8.  Create a page WebRoutine based on the following:

WebRoutine Name(page)
Web_Map For(*both) Fields(#empfrom #empto)
Web_Map For(*output) Fields(#emplist)
Case (#stdrentry)
When (= M)
#com_owner.browse I_Empfrom(#empnow) I_Empto(#empto)
When (= P)
#com_owner.previous I_Empfrom(#empnof) I_Empto(#empfrom)
#stdrentry := D
Transfer Toroutine(search)

Ignore errors  shown because the previous method routine does not yet exist.

Review the page WebRoutine which:

9.  Create the previous method routine based on the following:

Mthroutine Name(previous)
Define_Map For(*input) Class(#empno) Name(#i_empfrom)
Define_Map For(*input) Class(#empno) Name(#i_empto)
Clr_List Named(#emplist)
Select Fields(*all) From_File(pslmst) Where((#std_count <= 10) And (#empno >= #i_empto)) With_Key(#i_empfrom) Val_Error(*next) Options(*startkey *endwhere *backwards)
Add_Entry To_List(#emplist) After(*start)
If (#std_count = 1)
#empnow := #EMPNO
#empnof := #EMPNO
#cur_page -= 1
If_Status Is(*beginfile)
Message Msgtxt('No more records')
#stdprev := *blank
#stdprev #stdmore := Y

Review the previous method routine, which:

10. Extend the browse method routine to:

     Your code should look like the following.  New code is shown in red.

. . . . 
#cur_page += 1
If (#cur_page >= 2)

#stdprev := Y


#stdprev := *blanks


If_Status Is(*endfile)

Message Msgtxt(
'No more records')
#stdmore := *blank


If (#empno >= #empto)

Add_Entry To_List(#emplist)

Message Msgtxt(
'End of Search')
#stdmore := *blank



11. In the Search WebRoutine add code to initialize the STDPREV and STDMORE fields.

     Your code should look like the following. New code is shown in red.

When (= s)* Search Button#stdprev := *blank#stdmore := Y#com_owner.browse I_Empfrom(#empfrom) I_Empto(#empto)

12.  Compile and test your WAM in the browser.

a.  With search values such as from A0070 to A2000 you should be able to page forward until A2000 is reached (or the next nearest record if A2000 does not exist) and then page back until A0070 is reached.

b.  Perform a search from A0070 to A0090. The More and Previous images should not be displayed.

13. Notice that when the Search web page is initially displayed, the list images weblet is shown. To hide this when the page is initially displayed, make the following changes:

a.  Add the field STD_COUNT to the global WEB_MAP as a hidden field

b.  Open the Search webroutine in the Design view and select the std_list_images weblet. Define the hide_if property for the std_list_images as:

#STD_COUNT = ' '

     This logic must be added in the Xpath expression editor for the hide_if property. Note that the field name must be in upper case. The compare value is a space in XSL, not zeroes.

14. Recompile your WAM and re-test. The list images weblet should be hidden when the Search page is first displayed.