Redirect to Branch Conditionally

Hi,
I have a requirement. I need to search for domain_name or company_name if the result is true it must redirect to the desired URL link conditionally. I am trying with this method but its not working please find the below code.
DECLARE
L_ID NUMBER;
L_DOMAIN_NAME VARCHAR2(500);
L_COMPANY_NAME VARCHAR2(500);
BEGIN
SELECT ID, DOMAIN_NAME, COMPANY_NAME
INTO
L_ID, L_DOMAIN_NAME, L_COMPANY_NAME
FROM CUSTOMER_DOMAINS
WHERE
upper(trim(domain_name)) like upper((trim('%' || :P1_SEARCH || '%'))) or
upper(trim(company_name)) like upper((trim('%' || :P1_SEARCH || '%')))
IF L_ID IS NOT NULL THEN
RETURN HTP.PRN('<a href="http://www.one.com/"></a>');
End if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN HTP.PRN('<a href="http://www.two.com/"></a>');
END;
Please suggest me some alternative method to do this functionality
Thanks
Sudhir

Hi,
Thanks it worked for me with owa_util.redirect_url
DECLARE
L_ID NUMBER;
L_DOMAIN_NAME VARCHAR2(500);
L_COMPANY_NAME VARCHAR2(500);
BEGIN
apex_application.g_unrecoverable_error := true;
SELECT ID, DOMAIN_NAME, COMPANY_NAME
INTO
L_ID, L_DOMAIN_NAME, L_COMPANY_NAME
FROM CUSTOMER_DOMAINS
WHERE
upper(trim(domain_name)) like upper((trim('%' || :P1_SEARCH || '%'))) or
upper(trim(company_name)) like upper((trim('%' || :P1_SEARCH || '%')))
IF L_ID IS NOT NULL THEN
owa_util.redirect_url('f?p=&APP_ID.:4:&SESSION.::&DEBUG.::P4_DOMAIN_ID:' || L_ID);
End if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
owa_util.redirect_url('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::');
HTP.p ('<script type="text/javascript">');
HTP.p ( 'alert(''Record Not Found!'');');
HTP.p ('</script>');
WHEN TOO_MANY_ROWS THEN
owa_util.redirect_url('f?p=&APP_ID.:3:&SESSION.::&DEBUG.::P3_SEARCH:' || L_COMPANY_NAME);
WHEN OTHERS THEN
owa_util.redirect_url('f?p=&APP_ID.:3:&SESSION.::&DEBUG.::P3_SEARCH:' || L_COMPANY_NAME);
End;
One last issues i am facing is not able to call the javascript. Please suggest
I am using Apex 3.2 Version with Oracle 10g database.
Thanks
Sudhir

Similar Messages

  • Problem with Branch Conditions (Request = Expression 1)

    Application Express 3.1.0.00.32
    I've looked around on the internet and couldn't find anything to differ from what I thought I was doing correctly.
    The issue I am having is that I have 4 push buttons (2 on top and 2 on bottom) that when pressed, should redirect to the same page. For the branch condition, I set the type as Request = Expression 1 and placed the values that the buttons submit as in the expression 1 field.
    For the push button pressed, I do not have a button selected.
    In testing whenever I press a button, the following error is given:
    ERR-1777: Page 4 provided no page to branch to. Please report this error to your application administrator.
    Any ideas?

    Hi Leland,
    Check the names you have used in Expression 1.
    I have just created two buttons on a page called P4_BUTTON1 and P4_BUTTON2.
    My Expression 1 setting shows:
    P4_BUTTON1,P4_BUTTON2and the branch works ok
    Andy
    ps - if you have more than one button that could control the branch, the condition should be "Request is Contained within Expression 1"
    Edited by: ATD on Jan 14, 2009 5:45 PM

  • Bug report - Branch condition (SQL exists query)

    APEX 2.2.1
    See http://i13.tinypic.com/2ni8gol.jpg
    The branch condition is a "Exists SQL query" with select from dual where 1=2 i.e. it is a invalid SQL query, as the screenshot shows.
    But the APEX accept processing engine just ignores the syntax error and proceeds to evaluate the next branch.
    Thanks

    thanks, Vikas. It's interesting that if you don't have any later branches on the page that fire, you will see the condition error (along with the "no page to branch to" error).
    Scott

  • BPM Exception Branch: Condition?

    Hi everybody,
    sometime our JAVA-stack makes some problems:
    SYSTEM FAILURE&quot; during JCO-Call.
    In this cases some mappings fail and the BPM processes the exception branch.
    So we got the idea to put a wait step (e.g. 5 minutes) in the exception branch and than the BPM sends the origin received message to itself.
    The problem is now: The exception branch is also processed when other mapping errors occur.
    In this cases the wait stept should be processed!
    Do we have any chance to distinguish the case of error. Maybe to read the trace? But how can we read the trace in BPM to use it as a condition?
    Thanks
    regards, Mario

    Hi Mario,
    You can create an exception branch for MAPPING_EXCEPTION or what error you can see in the BPM when the mapping fails. This will trigger the branch with mapping exception when an alert is triggered.
    /daniel

  • Can anyone explain..? (branches conditional)

    Hi!
    In my application I have 2 branches with following logic:
    1. if ERRMSG IS null - Branch to Page 5
    2. else - Stay in Page 7
    If I use the condition: Value of Item in Expression 1 is NULL with :ERRMSG in the first branch and No Condition in the second it does not work.
    If I use the PL/SQL condition with: :ERRMSG is null it does work.
    The weird thing is: If I change the logic to
    1. if ERRMSG IS null - Branch to Page 7
    It DOES work with the Value of Item in Expression 1 is NULL branch.
    So my question is: Can anyone explain? Or tell me the difference between the conditions?
    Edited by: user1037913 on 2-jul-2010 1:35
    Edited by: user1037913 on 2-jul-2010 1:35

    >
    The weird thing is: If I change the logic to
    1. if ERRMSG IS null - Branch to Page 7
    It DOES work with the Value of Item in Expression 1 is NULL branch
    >
    It probably doesn't, it probably just hits the unconditional branch.
    Try changing the unconditional branch to have a sequence of 999 and remove the colon from the 'Value of Item in Expression 1 is NULL with :ERRMSG' branch. I would use PL/SQL anyway as it gives you more flexibility to change/add things later.
    Cheers
    Ben

  • Bug: branches conditional on page 0 buttons don't copy correctly

    I believe this is an HTML DB bug:
    If you copy a page containing a branch that is conditional on a button on page 0, the branch is converted to an unconditional branch when copied.
    Can you confirm if this is a bug, and if so, if it can be fixed in a patch or future release?

    Eric - Looks like a bug, thanks for pointing it out. It'll be fixed in a regular release.
    Scott

  • Additional Branch Condition Type in but not documented in HTMLDB UG v1.6

    I would like to understand this condition type for Branch processing:
    When Process in Comma Delimited List of Process IDs Has Run
    How are Process IDs known? Could an example using this condition be provided?
    Thanks,
    Kelly

    Kelly - This is a condition type available everywhere, not just for branches. However, it has never been implemented. It is an error that we make it available in these LOVs.
    Scott

  • Conditional branching after page submit

    Hi all
    I have a page where I need to submit and process the page and items(insert and update database) then branch to a certain page depending on which button was pressed. I have 4 buttons and each button should go to a different page, each button also needs to submit the page and process data(using an Apex DML process and passing 'SAVE' request in each button). the problem I'm having is that no matter which button I press the 'app branches to the first branch. I have 4 branches set to run after the process. Each branch should go to a different page depending on the button pressed. In each branch I have made the branch conditional based on the button pressed.
    APEX seems to ignore the button condition(in Debug) it says unconditional even though the button is definitely conditional.
    I'm running Apex 4.2.2
    It seems as though when I pass a Request of 'SAVE' Apex treats all buttons with this request in the same manner?Regardless of which button was pressed?
    Any ideas or alternatives?
    Thankyou
    Andrew

    Your problem is with setting the request of all the buttons to "SAVE", it will always fire the first branch for all those buttons.
    If you edit the DML process you will see the following:
    Valid Update Request Values:
    SAVE, APPLY CHANGES, UPDATE, UPDATE ROW, CHANGE, APPLY, APPLY%CHANGES%, GET_NEXT%, GET_PREV%
    This tells you the request values that will perform an Update DML.
    You could have one button be "SAVE", another, "APPLY CHANGES", another "UPDATE", and another "CHANGE".  They will all do the update DML for you and then the branches will have different request values to trigger off of.
    Another option is to set the request of each button like this:
    Button 1 - APPLY_CHANGES_INV
    Button 2 - APPLY_CHANGES_SALE
    Button 3 - APPLY_CHANGES_DELIV
    Button 4 - APPLY_CHANGES_INSTALL
    These would satisfy the valid update request value of APPLY%CHANGES%

  • Conditional Branch Execution?

    OK, Newbie here (and a bit frustrated). First application in the works.
    I have 2 ways to get to a page. When I click on the "Create" button, I want to return to the page that called the current page.
    Call them pages 1, 2 and 3.
    The default branching (unconditional branch) is 1 to 3 back to 1. This is a report to form back to report. This is the structure generated when I added the page when I initially generated the application.
    The secondary branching (conditional branch) is 2 to 3 back to 2.
    I set the sequence of the branches to do the conditional branch 1st then the unconditional branch 2nd.
    The "back to 2" is the problem.
    When I set it to "Unconditional" it works. When I set a condition it doesn't work.
    I tried "Request = Expression 1". I set the REQUEST in the button on page 2 to a specific value ("RETURN_TO_2"), but I suspect that when I click the "CREATE" on page 3 the REQUEST value is set to something else.
    So I tried saving the value of the REQUEST from page 2 in a page item on page 3 (P3_X) and used "Value of Expression 1 = Expression 2".
    I tried "P3_X", ":P3_X", "&P3_X", "v('P3_X')" in Expression 1 and RETURN_TO_2, "RETURN_TO_2" in Expression 2 (I think all possible combination of the to expressions).
    None of the combinations does the conditional branch!
    Any suggestions as to where I should go next?
    Thanks - JR

    John:
    I have found it helpful to use the 'Branch to Page Identified by Item (Use Item Name) ' type of branch in such cases.
    I specify the the page to return to in an application_item. The application_item itself is populated by a before header application_process. So if 'G_DEST' is the application item then the application_process simply is
    :g_DEST:= :app_page_id;In your case the branch defined in page 3 will be of the 'Branch to Page Identified by Item (Use Item Name) ' type and use the application_item 'G_DEST' as the item that holds the page-number that is to be the destination for the branch.
    Varad

  • Submit Action and Redirect page in Tabular form Column Link

    Hi All,
    I have a scenario to submit the current page and redirect to another page with the arguments, when i clink on the link which is created using column link in Report Attributes.
    I can able to perform the submit action, but redirection is not happening.
    Created a column link on non database column by providing
    Link Attribute :     <a href="#" onclick="doSubmit('SAVE')">#FAM_DET#</a>
    Target : Page in this application
    Page : 7
    Item name : P7_TRAVEL_REQ_ID
    item Value: #TRAVEL_REQ_ID#
    Item name : P7_TRAVEL_REQ_LINE_ID
    item Value: #TRAVEL_REQ_LINE_ID#
    Can anyone help me out to resolve this.

    811598 wrote:
    Please update your forum profile with a real handle instead of "811598".
    When posting a question here, always include the following information:
    Full APEX version
    Full DB/version/edition/host OS
    Web server architecture (EPG, OHS or APEX listener/host OS)
    Browser(s) and version(s) used
    I have a scenario to submit the current page and redirect to another page with the arguments, when i clink on the link which is created using column link in Report Attributes.
    I can able to perform the submit action, but redirection is not happening.
    Created a column link on non database column by providing
    Link Attribute :     <a href="#" onclick="doSubmit('SAVE')">#FAM_DET#</a>
    Target : Page in this application
    Page : 7
    Item name : P7_TRAVEL_REQ_ID
    item Value: #TRAVEL_REQ_ID#
    Item name : P7_TRAVEL_REQ_LINE_ID
    item Value: #TRAVEL_REQ_LINE_ID#
    Remove the link attribute (what you have used there is not the correct way to use this property anyway).
    Change the target page to the same page as the report.
    Set the Column Link Request property to BRANCH_TO_PAGE_ACCEPT|SAVE.
    Create an On Submit: After Processing (After Computation, Validation, and Processing) branch to page 7, conditional on the SAVE request.
    If the SAVE request can be triggered by something other than the report link (e.g. a Save button) then use another request value that will trigger the required page process in the link request and branch condition, e.g. BRANCH_TO_PAGE_ACCEPT|APPLY and APPLY respectively.
    Note that there is a bug in BRANCH_TO_PAGE_ACCEPT processing in APEX 4.2.3 and a patchset exception must be installed for this approach to work on this APEX release.

  • Use of javascript in branch

    Hi,
    I have a branch using the following javascript:
    javascript:{if (confirm('U heeft uw gegevens niet opgeslagen! Deze zullen verloren gaan. Doorgaan?')) redirect('f?p=&APP_ID.:1:&APP_SESSION.');}
    I can use this javacode in the branch of the button itself, but I want to use it in the page-branch, so I can make the branche conditional. How can I make my javascript work on the page-branch?
    Thanks.

    Hello,
    >> When the user presses the "cancel" button, I want to again put the values of the form in (another) APEX collection and compare the two.
    Well, you can only do that with AJAX. The following Blog entry, by Joel, will give you the basics - http://joelkallman.blogspot.com/2008/03/preserving-checked-checkboxes-in-report.html. This is not the same situation as you are describing, but all you need in order to create your own solution is there.
    Having said that, maybe you should consider a simpler solution (provided tracking changes is all you need). For example, attaching an onchange event to your updatable columns that will set a hidden item on the page. When the user presses the cancel button, you can check the value of this item. If it was set, you can issue a proper alert.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Branch IPSEC VPN Site with WCCP setup for vWAAS - Overthinking this

    OK, I have a fairly large WAAS environment so I'm kicking myself for overthinking this.  I have a particular branch that has an 881 router that terminates an IPSEC connection back to my main location.  I have a vWAAS at this branch site, so I'm going WCCP.  I got the license upgrade to enable to the WCCP feature set.  Now Im confused on the WCCP setup.  There is only 1 VLAN at the branch.  I have the WAAS setup to do WCCP GRE.
    Question is:  Would I do the redirect 61,62 on the VLAN1 internface?  I think I would, but Im used to dropping the 62 on the serial interface of my MPLS.  I.E.:
    int vlan1
    ip wccp 62 redirect in
    ip wccp 61 redirect in
    HERE IS THE CURRENT CONFIG
    ip wccp 61 redirect-list branch-waas
    ip wccp 62 redirect-list branch-waas
    interface Vlan1
    description Branch Data VLAN
    ip address 10.22.1.1 255.255.255.0
    ip nat inside
    ip virtual-reassembly in
    ip tcp adjust-mss 1452
    crypto ipsec client ezvpn Corporate-client inside
    ip access-list extended branch-waas
    remark WCCP Redirect ACL
    deny   tcp any any eq telnet
    deny   tcp any any eq 22
      permit ip any any

    wccp 62 is to intercept the WAN traffic, but if you put it on the LAN side, you have to catch the traffic on its way out:
    ip wccp 62 redirect out
    There is no need to deny telnet and ssh, those both have policies in WAAS for passthrough.  Also, I prefer to put my WAAS device on its own VLAN.  However, if it is going to be on VLAN 1, your access list will need:
    ip access-list extended branch-waas
    remark WCCP Redirect ACL
    deny   ip any host (WAAS IP)
    deny   ip host (WAAS IP) any
      permit ip any any
    To make sure you do not loop WCCP traffic.
    Just edited to change from TCP to IP in access list.

  • Condition statemsns

    Hello Friends,
    please give simple examples which invlove IF ,Else,endif,elseif

    Hi,
    When you branch conditionally, a processing block is executed or not based on the result of one or more logical conditions. ABAP contains two control structures for conditional branching.
    The IF Control Structure
    This control structure is introduced with the IF statement. The IF statement allows you to divert the program flow to a particular statement block, depending on a condition. The statement block concludes either with ENDIF, ELSEIF, or ELSE.
    IF <condition1>.
      <statement block>
    ELSEIF <condition2>
      <statement block>.
    ELSEIF <condition3>.
      <statement block>
    ELSE.
      <statement block>
    ENDIF.
    To formulate conditions in IF or ELSEIF statements, you can use any logical expression.
    If the first condition is true, the system executes all the statements up to the end of the first statement block and then continues processing after the ENDIF statement. If the first condition is not true, the program jumps to the next ELSEIF statement and executes it like an IF statement. ELSE begins a statement block which is processed if none of the IF or ELSEIF conditions is true. The end of the last statement block must always be concluded by ENDIF.
    You can nest IF control structures. However, the statement blocks must all end within the current processing block. So, for example, an IF - ENDIF block may not contain an event keyword.
    DATA: TEXT1(30) VALUE 'This is the first text',
    TEXT2(30) VALUE 'This is the second text',
    TEXT3(30) VALUE 'This is the third text',
    STRING(5) VALUE 'eco'.
    IF TEXT1 CS STRING.
      WRITE / 'Condition 1 is fulfilled'.
    ELSEIF TEXT2 CS STRING.
      WRITE / 'Condition 2 is fulfilled'.
    ELSEIF TEXT3 CS STRING.
      WRITE / 'Condition 3 is fulfilled'.
    ELSE.
      WRITE / 'No condition is fulfilled'.
    ENDIF.
    The output is:
    Condition 2 is fulfilled.
    Here, the second logical expression TEXT2 CS STRING is true because the string "eco" occurs in TEXT2.
    The CASE Control Structure
    This control structure is introduced with the CASE statement. The CASE control structure allows you to control which statement blocks are processed based on the contents of a data object.
    CASE <f>.
      WHEN <f11> [OR <f 12> OR ...].
           <Statement block>
      WHEN <f21>.[OR <f 22> OR ...]
           <Statement block>
      WHEN <f31> [OR <f 32> OR ...].
           <statement block>
    WHEN ...
      WHEN OTHERS.
           <statement block>
    ENDCASE.
    The statement block following a WHEN statement is executed if the contents of <f> are the same as those of one of the fields <f ij >. Afterwards, the program carries on processing after the ENDCASE statement. The statement block after the optional WHEN OTHERS statement is executed if the contents of <f> does not equal any of the <f ij > contents. The last statement block must be concluded with ENDCASE.
    The CASE control structure is a shortened form of the following IF structure:
    IF <f> = <f11> OR <f> = <f 12> OR <f> = ...
      <Statement block>
    ELSEIF <f> = <f21> OR <f> = <f 22> OR <f> =...
      <Statement block>
    ELSEIF <f> = <f21> OR <f> = <f 22> OR <f> =...
      <statement block>
    ELSEIF <f> = ...
    ELSE.
      <statement block>
    ENDIF.
    You can nest CASE control structures and also combine them with IF structures. However, they must always end with an ENDCASE statement within the current processing block.
    DATA: TEXT1 VALUE 'X',
    TEXT2 VALUE 'Y',
    TEXT3 VALUE 'Z',
    STRING VALUE 'A'.
    CASE STRING.
    WHEN TEXT1 OR TEXT2.
    WRITE: / 'String is', TEXT1, 'OR', TEXT2.
    WHEN TEXT3.
    WRITE: / 'String is', TEXT3.
    WHEN OTHERS.
    WRITE: / 'String is not', TEXT1, TEXT2, TEXT3.
    ENDCASE.
    The output is:
    String is not X Y Z
    Here, the last statement block after WHEN OTHERS is processed because the contents of STRING, ‘A’, does not equal ‘X’, ‘Y’, or ‘Z’.
    I think this will give u  an idea.
    Regards.

  • Logon redirect

    Hi,
    Iam customizing the logonpage.jsp, i have some conditions to check before redirecting the logon screen in to portal.
    If my condition is not satisfied, it must submit to the same page and give some message.
    I checked in the logonpage.jsp, the redirection and authentication are checking inside the logonbean.
    How can i stop the redirection if my condition is not satisfied inside the logonpage.jsp.
    Any help is appreciated.
    Thanks,
    Damodhar.

    Hi,
    Java script is not good idea for the security issues, end user can't se the logic behind the blocking.
    can anyone give me the idea how to stop the redirection and authentication when my condition is failed.
    i need to block perticular user group to access from internet.
    i am checking the user group, if he is part of that user group and he is accessing from outside ihave to block the access.
    for this we haver to submit the logon.jsp paeg to same and get the userID and check whether he is part of the group, if he is part of the user group and accessing from outside, i have to stop the redirection and authentication and throw the error.
    Thanks,
    Krishna

  • Passing a Value from one page to Another is not working

    Hi friends,
    I have a table called country in which i build a Form in page1 with a report in page2 based on the table. So iif i clicked the edit icon in the page 2 report means then it can fetch the corresponding record in the page 1 form as well(so that i can update the record in the form).
    My scenario is i have one more search page  in page 3 which has one page item like Country_id(text item) with a Region button "Find".
    If i typed any country id in the text item and pressed Find, means then it should redirect to the form page 1 inorder to fetch those correponding country id details that i entered in the search page page 3.
    For that i followed the below steps like in the search page 3
    created a Find button in the page 3 with below options
    Button Style: Template Based Button
    Button Template: Button
    Button Type: Normal
    Action: Submit Page
    Button Style: Template Based ButtonThen under the after Processing i created a branch condition:
    On submit: After processing(After Computation, Validation and Processing)
    Target Type: page in this Appliction
    page           : 1
    Set these items P1_COUNTRY_ID
    with these values: &P3_COUNTRY_ID.
    (when button Find is pressed)
    But the id is not passing to the page 1 from the page 3(search region) that i entered inorder to query my form in page 1 according to the value that i entered in  search region in page3
    kindly help me friends with this.. Hope u understand my scenario..
    Brgds,
    Mini

    Hi,
    Source setting for that form page item P1_COUNTRY is
    Source Used:"Only when current value in the session state is null"
    Source Type: Static Assignment.Since i build this form along with report.
    Is im missing something.
    Regards,
    Mini

Maybe you are looking for

  • Problem invoking webservice on weblogic managed server

    Hi Guys, I've created a web service using examples the BEA provides. When I deploy my web service on a ADMIN server it works fine. When I depoly my web service on a managed server, my client cannot find the WSDL file suppose to be located on the a ma

  • How do I configure Tomcat 4.0 to work with IIS 5.0?

    I want to deploy a jsp application in the "C:\Inetpub\wwwroot\jspapp\" folder and access that application from other machine on the net using the following URL: "www.mydomain.com/jspapp/default.jsp" instead of using "localhost:8080/default.jsp". Than

  • Is it possible to make a simple y vs x line graph, when neither of the two data series is in a header?

    For hours I have been trying to do this, without success.  When there are two columbs of numbers, in the bidy of a table (the sheet), there seems to be no way to make a line plot one column vs the other, as is easy to do in Excel.  A scatter plot see

  • Sort by Ratings

    It's 2006. Can we please sort by user RATINGS? Anywhere on apple.com Design is for users, yes? Please design. More. Many thanks. Addicted to Mac...more than to oil :-o

  • Show online status through HTML

    I am trying to show if I am online or offline through skype, but all the old pages lead to one that only lets me make a call/chat button and no longer has the code for the online/offline button. Is this no longer supported? If it is can someone share