Adding procedure calls to a custom item type

You can add procedure calls to custom item types and pass attributes as parameters to those called procedures. For an example, see Adding procedure calls to a custom item type: an example.

For information about adding attributes to a custom item type, see Adding attributes to a custom item type.

Note: You must be the page group administrator, the portal administrator, or have Manage privileges on All Page Groups to add procedure calls to a custom item type.

To add procedure calls to a custom item type:

  1. In the Navigator, click Contents next to the page group that contains the custom item type with which you want to work.

    Note: If the custom item type is shared, it will be in the Shared Objects page group.

  2. Click Custom Types, then Item Types.

  3. Click Edit next to the custom item type to which you want to add a procedure call.

  4. Click the Procedures tab.

  5. In the Type list, choose whether the procedure call is to an HTTP or PL/SQL procedure.

  6. In the Procedure Call field, enter one of the following:

  7. In the Link Text field, enter the text to display as a hypertext link with an item of this type. Users click this link to execute the procedure call.

    Note: This link is displayed only if you do not select Display Procedure Results With Item, or you have not specified an icon.

  8. In the Icon field, enter the path and file name of an image to associated with this procedure call. This icon is displayed instead of the value entered in the Link Text field.

    Click Browse to locate the image if you are not sure of its path or file name.

    Note: If you specify an icon, you must still enter a value in the Link Text field. The text is used as rollover text for the image.

  9. Select Display Procedure Results With Item to display the results of the procedure call directly in the page area with an item of this type instead of displaying a link or image for users to click to execute the procedure.

    This is useful if you want the procedure results to be immediately visible to users, rather than requiring them to execute the procedure call themselves by clicking the link.

  10. If the procedure being called has parameters, you can pass attributes to those parameters.

    1. In the Attribute list, choose the attribute to pass to the parameter in the procedure.

      Note: This list includes any additional attributes added to the custom item type as well as the default attributes.

    2. In the Pass As field, enter the parameter name if it is different from the attribute name.

  11. Click Apply to add the procedure call to the custom item type and display it in the Existing Procedure Calls section.

  12. To add more procedure calls, repeat Steps 5 through 11.

  13. Click OK.

Adding an HTTP procedure call to a custom item type: an example

Imagine that your portal provides movie reviews to subscribers. To customize the hundreds of movie reviews you plan to upload, you create a Movie Review item type on which to base each review. Knowing that users will want to find additional information about each movie, you decide to include a link to a search engine within the review.

To include this link, you choose HTTP as the procedure type, and add the following to the Procedure Call field:

http://www.google.com/search

You include the link text "Click here for more...", and you specify an icon to associate with the procedure. You choose not to display the procedure results with the item because you want users to click the icon to access the search.

For the search engine to return information about the appropriate movie, you need to pass it the movie titles. Say your Movie Review item type includes an attribute called "Movie Title". To pass the value in this attribute to the search engine, you select it in the Attribute list. (You could also use the Display Name attribute if it is used to store the title of the movie.)

Finally, you need to make sure that the attribute value is sent to the correct search engine parameter. In the case of Google, the search parameter name is "q", so enter this name in the Pass As field.

This information is appended to the Procedure Call as follows:

http://www.google.com/search?q=<MovieTitle>

Note: If you created the attribute and it does not display, you may need to add the attribute to the custom item type.

Each movie review will now include a link to a customized search based on the movie title.

Movie review item showing link to HTTP procedure

When users click the specified icon (or link), the customized search content (based on the movie review title) displays. The movie title, which is the search criteria, displays at the top of the search results page.

Adding a PL/SQL procedure call to a custom item type: an example

Imagine that you have written the following procedure that displays the creator and create date of an object in an HTML table:

--
-- PROCEDURE SCOTT.DISPLAY_ATTRIBUTES
-- created Monday 17-JUN-2002 10:35
--
create or replace
PROCEDURE DISPLAY_ATTRIBUTES (
  p_creator IN VARCHAR2,
  p_create_date IN VARCHAR2)
as
begin
  htp.p('<table><tr><td><b>Creator:</b></td>'
  || '<td>' || p_creator || '</td></tr>'
  || '<tr><td><b>Create Date:</b></td>'
  || '<td>' || p_create_date || '</td></tr>'
  || '</table>');
exception
when others then
  htp.p(sqlerrm);
end;

You can add a call to this procedure to a custom item type (My Item Type) so that this information is displayed for items of that type.

You choose PL/SQL as the procedure type, and add the following to the Procedure Call field:

SCOTT.DISPLAY_ATTRIBUTES

You include the link text "Display attributes", and you specify an icon to associate with the procedure.

For the procedure to return the appropriate attribute values, you need to pass it the attribute names. Your procedure includes two parameters: p_creator and p_create_date. You need to pass these two parameters information from the Creator and Create Date attributes.

Each item of type My Item Type will now include a link to run the procedure.

When users click the specified icon (or link), the additional attributes are displayed in an HTML table.

Notes

Related topics

What is an item?
Creating a custom item type
Changing a custom item type's basic properties
Adding attributes to a custom item type
Deleting a custom item type
Choosing the item types available in a page group