Creating Custom Word Replacement Conditions

Create custom conditions to use with word replacement pairs. You have a lot of flexibility, so make sure that the conditions you create make sense and work correctly.

Each condition includes a defined function and possible user-defined values. For example, the user must specify at least one value, such as Argentina, when defining a word pair with the seeded If Country Equals condition. If the record being evaluated has Argentina as the Country attribute, then the word replacement occurs.

On the other hand, the seeded End of String condition and does not require a user-defined value. If the original word is at the end of a string and the replacement word does not cause the entire string to be null, then the word replacement occurs.

Procedure

  1. Write a custom function with this signature:

    FUNCTION <custom function>(
        p_input_str     IN  VARCHAR2,
        p_token_str     IN  VARCHAR2,
        p_condition_id  IN  NUMBER, 
        p_condition_val IN  VARCHAR2)
    RETURN BOOLEAN;
    

    The tca_eval_condition_rec function is used for all seeded conditions. Instead of defining a new function, you can use the seeded one and write custom code in the if/elseif block for the condition_id, as shown in this example:

    IS 
    BEGIN
       if condition_id  = 1
            get_gbl_condition_rec_value( 'PARTY_SITES', 'COUNTRY' )  = 'US'
            		do this and return true/false ;
      elsif condition_id = 2
            get_gbl_condition_rec_value( 'PARTY_SITES', 'ZIPCODE' ) = 'xxxxxx'
            		do this and return true/false ;
      else
           return true ;
    END  ;
    
  2. Insert a new row in the HZ_WORD_RPL_CONDS_B table and populate the columns.

Related Topics