Redirect user to a different Page based on number of  Liquid output result

I want to redirect the user to a different page based on the number of results. I have some multi-account users and single account user in my secure zone. I want single account users to be sent to a different page, while multiple account user should be shown their accounts and they user can now click the account he/she wants to access. This is my code:
{module_data resource="customers" fields="company, email1"  where="\{'company':\{'$contains':'{{this.globals.user.email}}'\}\}" skip="0" limit="500"  version="v3" collection="companyXtra" template=""}
{module_webapps id="21927" filter="all" collection="companyAccess" template=""}
{% for item in companyAccess.items -%}
{% assign counter = {{forloop.length}} -%}
{% if globals.user.email = item.email and counter = 1 -%}
<script>
window.location.replace("/single-account-user.html");
</script>
<a class="w-inline-block szone-navlinks multiplecoy" href="{{item.url}}">
    <div class="szone-holder">
      <div class="szone-narrate addenrolee">{{item.name}}</div>
    </div>
  </a>
{% else %}
<p><a href="{{item.url}}">{{item.name}}</a></p>
{% endif %}
{% endfor %}
</div>
Please what I'm doing wrongly. Can someone kindly assist. Thanks.

Hi Liam I have since been reviewing my query using the BC API Discovery which has been a good guide for me. But the result is just displaying the core customer's company, though the other company has a default email/email1 as the core customer.
This is my new query:
{module_data resource="customers" version="v3" fields="company" skip="0" limit="10" where="\{'email1.value':\{'$contains':'{{globals.user.email}}'\}\}" order="id" collection="myData"}
<pre>{{myData|json}}</pre>
This is the json:
  "moduleName": "data",
  "moduleDescriptor": {
  "templatePath": null,
  "parameters": "resource=\"customers\",version=\"v3\",fields=\"company\",skip=\"0\",limit=\"10\",where=\ "\\{'email1.value':\\{'$contains':'[email protected]'\\}\\}\",order=\"id\",collection=\"myData\"",
  "apiEndpoint": "/api/v3/data",
  "objectType": "-1",
  "objectId": "-1",
  "adminUrl": ""
  "items": [
  "company": "The vivove company Limited"
  "totalItemsCount": 1,
  "skip": 0,
  "limit": 10,
  "params": {
  "resource": "customers",
  "version": "v3",
  "fields": "company",
  "skip": "0",
  "limit": "10",
  "where": "\{'email1.value':\{'$contains':'[email protected]'\}\}",
  "order": "id",
  "collection": "myData"
I expected to see two companies. This is screenshot of my the companies in the CRM:
Screenshot by Lightshot
Screenshot by Lightshot
Thanks. most appreciated.

Similar Messages

  • Redirect to different pages based on user input value

    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    Orton

    orton607 wrote:
    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    OrtonI have a similar scenario in my application and this is how I handle it.
    1. Create a page item on the page, say Px_PAGE_NUM
    2. Create a "On Submit - After Computations and Validations" page process to set the above page item. In your case, you can use the same logic that you have already in place (except the call to OWA_UTIL.REDIRECT_URL) :
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
       :Px_PAGE_NUM := '1';
    end if;
    if v_job = 'MANAGER' then
       :Px_PAGE_NUM := '10';
    end if;
    end;3. Create a "On Submit: After processing" branch. Specify the "Target Type" as "Page in the application" and "Page Number" as &Px_PAGE_NUM. (with the dot).
    I hope the above helps.
    BTW, the following thread in the forum related to OWA_UTIL.REDIRECT_URL might help:
    issue OWA_UTIL.REDIRECT_URL with APEX 4.1.1

  • Redirecting to different pages based on value from table linked from report

    Hi,
    I wanted to navigate to different pages from a report link based on a value from the table on which the report is built. I was able to link to particular page without any problem.
    But, I wanted to link to different pages based on value in the table. Please let me know how can I do this?
    Thanks,

    kaminey wrote:
    Hi,
    I wanted to navigate to different pages from a report link based on a value from the table on which the report is built. I was able to link to particular page without any problem.
    But, I wanted to link to different pages based on value in the table. Please let me know how can I do this?APEX version?
    Is this a standard or interactive report?
    How does the value from the table determine the target page used in the link? Is it a page number? Or the result of some computation or process?
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • How to redirect user on or before page load

    Hi,
    what is best practice for redirecting a user when he opens a specific page.
    I have a solution with a custom master page and several webparts. When a user opens my solution (every page based on the same master). 
    What i need to do now is, when the user opens the page i have to check before rendering the page and the webparts some criteria. When the user is not allowed to open the page i need to redirect him to another location.
    How could q redirect a user in a sharepoint solution?
    I thought about some ways:
    - develop a webpart (without any rendering) and put in onprerender event the check and the redirect
    - create a codebehind for the masterpage
    - create an httpmodule
    What would you prefer? How could i solve it?
    Best Regards
    Bog
    Developers Field Notes | www.bog1.de

    Hi,
    In SharePoint on-premises, I suggest you use HttpModule and HttpHandler to achieve it.
    http://sharepointgotchas.wordpress.com/tag/httpmodule/
    http://zoomsharepoint.blogspot.com/2009/09/redirect-page-using-http-module.html
    In SharePoint online, JavaScript is a better choice, we can add some JavaScript code in the master page.
    http://sharepointtipsntricks.blogspot.com/2009/06/redirect-to-another-aspx-using.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Branch to different page based on the selection of select list

    Hi All,
    I have to create an application in which i have a form containing a field with static lov's ...
    now i want that whenever i click on a save button it branches to some page based on the selected value of lov of that field...
    like if i select marketing from lov and press save button then it will branch me to marketing page...
    so how can i achieve that in my apex application
    please help if anyone knows the answer

    in the page branch, change the page to *&PX_LOV_NAME.*
    change X to page number and the LOV_NAME to the name of your select list
    Don't forget to add the . on the end
    Hope this helps

  • How can I conditionally present different pages based upon a promo code?

    I am sending out a general mailing to a list of potential clients.  I have broken this group into five unique subsets, and each mailing will include a specific (one of five) promo codes.  When a user comes to my website, I want to allow then to enter the promo code, and then I will display one of five specific pages that is tailored to their needs.  If anything else is entered into the field, a general error page will be displayed.  I am using Dreamweaver CS4 and I have created several websites.  I have experience using forms.  I am assuming that I will need to utilize dynamic pages to accomplish this; if there is an easier way, please let me know.  Given that there isn't an easier way, can someone please tell me how to (or where I can find) create and utilize dynamic pages?  Omar

    Hi Omar,
    On a side note, should I close this question and move it to the Development forum?  Being new to utilization of forums, I'm not quite certain of the etiquette.
    It´s certainly not a matter of "etiquette" ;-) I think you´re right, because posting your question in the regular Dreamweaver Application Development forum instead will have one huge advantage :: over there you´ll address a huge number of fellow developers and hence get help and different suggestions much quicker, whereas in this forum (which is about a former Dreamweaver application development extension which has been discontinued in April 2009) I have regretfully become the only one who still answers stuff.
    Cheers,
    Günter

  • Firefox does not redirect users to web auth page

    I have a client that uses web auth for the guest wireless.  When a users opens up FF, it does not automatically redirect them to the web auth page.  However, IE and Chrome work fine.  If you copy and paste the redirection page into FF, it will go to the page then.  The only two possible solutions I have found are to either enable web auth proxy or regenerate the WLC self-signed cert. 
    Anyone have any other ideas? 
    TIA,
    Dan

    I've been trying to figure out a very similar issue where Firefox wouldn't open the guest webpage (the connection was interrupted) and finally found it was caused by opening Yahoo as my startup page. I change it to Google, for example, and it comes up everytime now. When set to Yahoo I could clear my cache and it would work once but then wouldn't work again. If I load Yahoo as the startup page in IE it works everytime. Very strange.
    Here's what the debug looks like:
    *webauthRedirect: Jul 23 20:59:33.793: xx:xx:xx:xx:xx:xx- received connection
    *webauthRedirect: Jul 23 20:59:33.794: xx:xx:xx:xx:xx:xx- received connection
    *webauthRedirect: Jul 23 20:59:33.795: xx:xx:xx:xx:xx:xx- received request
    *webauthRedirect: Jul 23 20:59:33.803: xx:xx:xx:xx:xx:xx- received connection
    *webauthRedirect: Jul 23 20:59:33.803: xx:xx:xx:xx:xx:xx- received request
    *webauthRedirect: Jul 23 20:59:33.806: xx:xx:xx:xx:xx:xx- received connection
    *webauthRedirect: Jul 23 20:59:33.807: xx:xx:xx:xx:xx:xx- received request
    *webauthRedirect: Jul 23 20:59:33.810: xx:xx:xx:xx:xx:xx- received connection

  • Redirect http requests to different servers based on URL

    You can use a reverse proxy to do this, but if you have a single IIS box in a DMZ you can also use IIS ARR (Application Routing Request) to do this for you.
    https://knowledge.safe.com/articles/How_To/Using-IIS-and-ARR-as-a-reverse-proxy
    You may find better articles if you look, but it is easy enough to do.

    Hi,
    We have an internet connection (with a single IP address) where I need to share access to different internal servers based on the requested URL.
    I.e.:
    http://url1.domain.com -> webserver1
    http://url2.domain.com -> webserver2
    etc.
    It's http traffic only (no https).
    How do I accomplish this? I assume some kind of proxy server-thing that all requests go to? It should be on the Windows platform as we don't want to introduce a Linux "black-box" that noone knows anything about in a production environment.
    Thanks for any ideas and/or suggestions :) 
    This topic first appeared in the Spiceworks Community

  • How do I use Edge Animate to make a clickable image which can be used in Author, and which will redirect you to a different page in your ebook?

    If anyone has experience with Edge Animate, I know that I can make an image clickable, and I can insert a url to define where it will go once clicked. But I want to make a widget to use in iBooks Author, that can take the reader to a certain page of the book. Is this possible?
    It all seems very complicated. Make one thing in Edge Animate, then somehow have that reference something in Author, which will finally work in an ebook. I have no clue where to begin.

    Sort of. I'm using this code inside an action for a button symbol. But it doesn't work perfectly. Trying to debug it.
    Let me know if you have any luck.
    //Check to see if pageCounter already exists
    if (typeof EC.pageCounter === 'undefined') {
      // it doesn't exist so initialize it to first page
        EC.pageCounter = 2;
    //check if the page is only 1 digit -- patch for single digit
    if (EC.pageCounter < 9) {
       // it is, so we need to pad a 0 on the front.
      EC.pageCounterString = "0" + EC.pageCounter;
      //e.g.  01 ...09,11,12,13....115,222352,,....
    else {
      EC.pageCounterString = EC.pageCounter;
    EC.loadComposition(EC.pageCounterString + "/publish/web/" + EC.pageCounterString + ".html", sym.$("container"));
    EC.pageCounter = EC.pageCounter + 1;
    //TODO for back  -1

  • How do a make a clickable image redirect you to a different page in iBooks?

    I know that I can make an image clickable, and insert a url where it will go once clicked. But I want to make a widget to use in iBooks Author, that can take the reader to a certain page of the books depending on what they click. Is this possible?

    edit your button and add a big shape to its hit frame.

  • User exit for material code based on number range

    Hi viewers,
    Can you please tell me the User exit to be identified for material code t based on  the number range (External or Internal)
    For ex: LAFAMLP is the material code I want this material code as case sensitive .
    It should take what ever case we give.
    Regards
    Kumar

    Hi,
    First goto MM01 transaction code in menu System-> status..pick the program name ,then
    Goto SE38 give that program name select Attributes radio button click on Display button,
    you will get one popup from the popup pick Package ...
    Then now goto SMOD transaction in menu utilities(or/any one of the menu you will find (find option ))->Find this will list out all the possible exits...As follow
    mga00001 material master (industry): checks and enhancements
    mga00002 material master (industry): number assignment
    mga00003 material master (industry and retail): number display
    I think second one will help for you ,,,here you can code your requirement

  • How to print new main report page based on number of records in subreport?

    Hi,
    I've a main report which prints on a pre-printed stationary with 2 subreports in the detail section.  The subreport prints multiple records.  If there are more than 6 records in the subreports, a new page should be printed with all the contents of the main report and the subreports should continue with the remaining records.  How can I do this?  I've tried incrementing a shared variable counter in the subreport and accessed that variable in the detail section of the main report to check the counter and reset the counter to 0 if it exceeds 6.  But this does not work.  All the lines till it can hit page footer are printing on first page and the second page prints only the remaining subreport lines without the other details of the main report page. 
    The main report page uses a view which returns only 1 record. The subreport returns multiple records. 
    I would certainly appreciate if any one can provide a solution for this problem. 
    Thanks,
    Ram

    hi Ram,
    sorry, i misunderstood exactly what you wanted.
    let me get this straight...
    1) if there's more than 6 records in the subreport then show only the first 6 records
    2) then (if there's more than 6 records) do a new page after the subreport
    3) then (if there's more than 6 records) show the subreport's remaining records and the rest of the report
    let know if i've got it straight.
    if that is correct, you will have received another sample report that does this. in total 3 subreports are used...one is a dummy report that adds up the number of records which is used later. there's more info on the report's design mode.
    cheers,
    jamie

  • How to redirect to different page after login in APEX 4.1

    Dear All,
    Here my Requirement is,When the users login,
    when they entered their username and password and pressed login button,
    they have to redirected to different pages based on the type of user.
    Here my LOGIN_TABLE has following 3 columns,
    1.Username
    2.Password
    3.Type.
    The TYPE has 2 values, employee and admin.
    when the type is admin they should be redirected to page 2,
    reaining i.e employee users has to be redirected to page 3.
    How can I do this? please give some suggestion.
    Thank you.
    regards,
    Gurujothi

    Dear Christian,
    Thank you for your reply,
    I would like to explain something,
    When I using the following function,
    *create or replace FUNCTION custom_auth_g (
    p_username IN VARCHAR2,
    p_password IN VARCHAR2)
    RETURN BOOLEAN IS
    BEGIN
    FOR c1 IN (SELECT 1
    FROM login_table
    WHERE upper(username) = upper(p_username)
    AND upper(password) = upper(p_password))
    LOOP
    RETURN TRUE;
    END LOOP;
    RETURN FALSE;
    END;*
    When login, It checks in the login_table table and if the username is exist with the pass word it successfully entered inside the application.
    for all users only one page which we set.
    My Login_table also contains type which has 2 type as I mentined above.
    But As I mentioned earliar based on the user type it has to be redirected to 2 different page.
    I found this Package but I cant understand,Can you please Explain?
    *create or replace PACKAGE app_security_pkg
    AS
    PROCEDURE add_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    PROCEDURE login
    p_uname IN VARCHAR2
    ,p_password IN VARCHAR2
    ,p_session_id IN VARCHAR2
    ,p_flow_page IN VARCHAR2
    FUNCTION get_hash
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    RETURN VARCHAR2;
    PROCEDURE valid_user2
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    FUNCTION valid_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    RETURN BOOLEAN;
    END app_security_pkg;*
    *create or replace PACKAGE BODY app_security_pkg
    AS
    PROCEDURE login
    p_uname IN VARCHAR2
    ,p_password IN VARCHAR2
    ,p_session_id IN VARCHAR2
    ,p_flow_page IN VARCHAR2
    IS
    lv_goto_page NUMBER DEFAULT 1;
    BEGIN
    -- This logic is a demonstration of how to redirect
    -- to different pages depending on who successfully
    -- authenticates. In my example, it simply demonstrates
    -- the ADMIN user going to page 1 and all other users going
    -- to page 2. Add you own logic here to detrmin which page
    -- a user should be directed to post authentication.
    IF UPPER(p_uname) = 'ADMIN'
    THEN
    lv_goto_page := 1;
    ELSE
    lv_goto_page := 2;
    END IF;
    APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');
    wwv_flow_custom_auth_std.login
    p_uname => p_uname,
    p_password => p_password,
    p_session_id => p_session_id,
    p_flow_page => p_flow_page || ':' || lv_goto_page
    EXCEPTION
    WHEN OTHERS
    THEN
    RAISE;
    END login;
    PROCEDURE add_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    AS
    BEGIN
    INSERT INTO app_users (username, PASSWORD)
    VALUES (UPPER (p_username),
    get_hash (TRIM (p_username), p_password));
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    RAISE;
    END add_user;
    -- Function to Perform a oneway hash of the users
    -- passwords. This cannot be reversed. This exmaple
    -- is a very week hash and if been used on a production
    -- system, you may want to use a stronger hash algorithm.
    -- Read the Documentation for more info on DBMS_CRYPTO as
    -- this is the supported package from Oracle and
    -- DBMS_OBFUSCATION_TOOLKIT is now depricated.
    FUNCTION get_hash (p_username IN VARCHAR2, p_password IN VARCHAR2)
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN DBMS_OBFUSCATION_TOOLKIT.md5 (
    input_string => UPPER (p_username)
    || '/'
    || UPPER (p_password));
    END get_hash;
    PROCEDURE valid_user2 (p_username IN VARCHAR2, p_password IN VARCHAR2)
    AS
    v_dummy VARCHAR2 (1);
    BEGIN
    SELECT '1'
    INTO v_dummy
    FROM app_users
    WHERE UPPER (username) = UPPER (p_username)
    AND PASSWORD = get_hash (p_username, p_password);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN raise_application_error (-20000, 'Invalid username / password.');
    END valid_user2;
    FUNCTION valid_user (p_username IN VARCHAR2, p_password IN VARCHAR2)
    RETURN BOOLEAN
    AS
    BEGIN
    valid_user2 (UPPER (p_username), p_password);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS
    THEN RETURN FALSE;
    END valid_user;
    END app_security_pkg;*
    And you said "assign an URL to FSP_AFTER_LOGIN_URL, depending on the Type column",
    Where to assign,Could you please Explain?
    Thank you.

  • Creating login page - direct users to a unique file based on unique id?

    Hello - I am in the process of creating a login page that will direct users to a unique page based on their unique id.  I would normally go to Server Behaviors>User Auth>Log In User, but that gives me the option of browsing only one file for all usernames and that's not what I need.  So basically, if the user logs in with the Caterpillars username, it takes them directly to the Caterpillars page and if they log in with the Butterflies username, it takes them to the Butterflies page (yes, it's a preschool with goofy classroom names!).  If it matters, I'm using MySql and the page is .php.  I tried to upload the php, but it gave me an error "the content type of this attachment is not allowed" - not sure what that's all about - sorry.
    Thanks in advance!!

    I was trying to do the latter - store the path for each individual file (catepillars.html, butterflies.html, etc) in the database with the login info.
    My problem is that I can't get it to direct to that page in the code.  My understanding is that I have to tell it in within this code <?php echo $row_MM_Username['login']; ?> that if username is caterpillars then they go directly to caterpillars.html...
    For your desire you don't need extra database fields, recordsets, session variables or anything else if you want to direct username to a static username.html file
    Instead use a dynamic META redirect in <head> of success.php page based on session variable for Username and append .html to the username.
    <META http-equiv="refresh" content="0;URL=http://example.com/<?php echo $SESSION['MM_Username']; ?>.html">
    You could add the show if users is logged in server behavior to success.php and wrap the meta redirect in it so that if the user is logged in then you are redirected to username.html or just add a restrict access SB so that you can not visit success.php (and be redirected to username.html) unless you are logged in.
    Does that solve your problem?
    It may have been easier to explain if your original inquiry mentioned that you wanted logged in users to go to a static .html page based on their username like username.html (sighs). FWIW I would still follow my original recommendation of using one dynamic file to display different users info on one page because as mentioned you only have to maintain one file vs. multiple static files.

  • Redirecting user to acustom page depending on security role after glassfish

    Hi,
    I have a JSF application using glassfish authentication mechanism. I'm planning to use a jdbc realm and form based authentication (I'm using a jsp page to get username and password) . I have 3 different user roles (student, admin and staff)
    However I cannot find how to redirect a user to a different page (Ex: staff report page if the logged in user is in the security role staff). I have configured sun-web.xml and web.xml to map the roles and groups. The problem is after authentication the user is always redirected back to the home page, which is the login page. I understand this is how the glassfish authentication works by default. But is there a way to navigate the user to a different page depending on his role.
    I'm new to EJB security. Please help me on this subject. Thanks a lot in advance.

    Check this blog post, which provides an alternate solution (You can choose the best possible solution based on your use-case).
    http://andrejusb.blogspot.com/2007/10/security-in-oracle-adf-and-automatic.html
    Thanks,
    Navaneeth

Maybe you are looking for