Apex - passing a variable from one page to another - sql

I have a form on one page which prompts a user to enter their email address. When they click "next" I want Apex to redirect the user to a different page which shows them a report which selects the records from the users table where the email address matches the one that they entered.
E.g.
SELECT *
FROM USERS
WHERE EMAIL_ADDRESS = (the email address that they entered on the previous page);
Can someone please explain the easiest way to do this?

I have only in the last 5 seconds heard about 'Apex' Lol ... But I think I found what you need to do.
You need to define a 'Branch' which will allow you to POST to whichever page you need to.
Here's some documentation on 'Branches': http://docs.oracle.com/cd/B32472_01/doc/appdev.300/b32469/pdf_report.htm#BABICIJG
Also this snipet may help:
It's [The 'branch'] in the middle (page processing section) of the
development page at the bottom. The branch will be executed whenever a
post submission occurs but you can put conditions on the branch.
Which I found at: http://dbaforums.org/oracle/index.php?showtopic=8139

The "Next" button should not redirect but should submit. The value of the page item has to be pushed to the session state for it to be available in the (apex) session. On submit you can then define a branch which will take you to the page with your report. Your report can then reference the page item by using bind variable notation in the region source:
SELECT * FROM USERS WHERE EMAIL_ADDRESS = :Px_EMAIL_ADDRESS

Related

How to control what fields there are in the address pop-up?

I'm configuring CRM 2013 for a client and they are very strong on not showing the state field. However, on the form, I only see Address 1. When I access the page as a user, when I try to enter the data, there are five or six fields in the pop-up, though.
How can I get rid of that?!
Business Rule (new 2013 functionality):
no condition - fire always
Action: Address1: State/Province - Hide field
or
Get into unsupported jscript and try to hide it.

Woocommerce select email address destination only for new order notification(admin) through form checkout it's possible?

Scenery: 1 store and 2 locations. I already have select field form (checkout) where the customer select which store is closest to your location, eg: city A or city B.
Now I need that the new order notification (admin) sent ONLY to e-mail the city shop chosen in form.
Seems to me that all this operations occurs near: class-wc-order, class-wc-checkout.php
But I belive that exist that do it only using filters
Any ideas?
Thanks advance.
$_SESSION Vars on WooCommerce work's fine.
Well not the fine way, but also not worst too!
Create a jquery ($.ajax) function to call one php script external file and register the session variable ($_SESSION).
In my case this php is in (eg: public_html/loadvar.php), this file receive $_POST variables through ajax (in my case: when the user select your office location prefered, this value eg: emailA or emailB according office selected (onChange event) )
I used this session variable to store the alternative email addresses. (not admin_email default)
In (class-wc-checkout.php) , retrieve these values (session variable) eg: email1 or email2... previously selected on form checkout, and overriding the "get_option( 'admin_email' )" by the $_SESSION value
Now, users can choice the office that prefer, and only the selected office will receive the quote request
Note: I only can use this session vars on woocommerce configuring wp_unregister_GLOBALS() on wp-includes/load.php or disable it commenting this function.
This worked (not is state-of-art code) maybe dirty code but can't need deep coding, obviously not "strict patch" this will not survive an update
Thats all folks

MVC user's full name in Url, how to handle duplicates

I want to setup the following url in my MVC4 website, using the user's full name in the url:
http://www.myapp.com/profile/steve-jones
I have setup the following route in Global.asax:
routeCollection.MapRoute(
"profile", "profile/{userName}",
new { controller = "myController", action = "profile", userName = string.Empty
});
And I can take the parameter 'steve-jones' and match it to a user with matching name. My only problem though is, what if there is more than one 'Steve Jones', how can I handle this?
Does anyone know of a workaround/solution to this so that I can use a user's full name as part of the url and still be able to retrieve the correct user in the controller method?
Am I forced into including the user's id with the url (something that I do not want to appear)?
The usual way of handling this is by appending a number when creating the profiles. So if "steve-jones" is already a name in the database, then make the user's display name "steve-jones2". You basically have to insist that all profile urls are unique, which includes updating any existing database and account creation code.
Alternatively (and/or additionally), if two same names are found then have the script reroute to a disambiguation page where the user is presented with links and snippet of profile info of the many existing Steve Joneseses so they can go to the full correct profile.
Another way of handling it is by giving all user profiles an additional numeric code on the end. At my university all logins are based on name, so they give everyone pseudo-random 3-digit extensions so that they are safe as long as they don't get 1000 people with the exact same names :)
Some people might be happier being steve-jones-342 if there is no steve-jones or steve-jones1, if you're concerned.

Getting Google+ business page ID based on vanity URL

We are looking to implement rel=publisher to verify our website against our Google+ page.
However, according to the Rich Snippets tool, this only appears to work with a numeric page ID: e.g. https://plus.google.com/103037366582313115962/
However, we have a vanity URL https://plus.google.com/+TheGuardian
How can I find out our numeric page ID based on a Vanity URL?
OK, worked this out:
Go to https://plus.google.com/ as a Google+ user.
Search for your page using the search box
Copy the link location of the search result for your page. e.g. https://plus.google.com/u/1/113000071431138202574
...The last fragment of the URL is your Google+ page id
In order to get the 21 digit ID from a vanity URL, you need to utilize people.get API!
Just enter the vanity URL portion with the plus sign (for example +Name) as the userId here and scroll down to the 'Response' section to get your id.
Go to the G+ page
Press Ctrl+U then Ctrl+F
Type data-oid.
ex: data-oid="101059889519664604142"
You just have to do is right click on on name (page name or person name) select Copy Link Address & paste it in a new Tab you will see the code as my is https://plus.google.com/+InzimamTariq
but when I do that this is in return.
https://plus.google.com/109309640886924591969
hope you like it & it will help you
Go to -> www.Google.com
[Press] +UserName where "UserName" is your user name
(usually your email is UserName#google.com)
Hover over Home in top left for drop down menu
Just below Home you should see Profile <- click on Profile
Check your URL and if should look like this:
https://plus.google.com/u/0/+UserSetUrl/posts
or
https://plus.google.com/u/0/12398987468276/posts
The +UserSetURL is your google+ profile name.
If you have not created your own specific URL / ID then the numbers are your ID.
You should change the Numbers to something easy like MyName or UserID so you won't have to do this ever again.
Note: This is according to UI as of April 28, 2015

How to use a hidden page item within an SQL report query without submitting

Using: Oracle ApEx 3.0.1
I have a SQL report region that contains a hidden page item as part of the "where clause". My problem is, based on a value entered by the user, I need to assign this value entered to my hidden item, so that it can be used within the where condition of my SQL but this would need to be done without actually submitting the form.
At the moment, I can set the value via an on-demand process but my SQL is still not returning any values as the hidden page item within the query is not set (as page has not been submitted).
I am not sure how to do this and whether in actual fact, this is possible to do, without having submitted the page.
Since you are on Apex 3, you don't have dynamic actions, but that doesn't hinder so much.
I've set up an example on apex.oracle.com. To get in the workspace, use workspace 'tompetrusbe' + apex_demo / demo.
There is a dynamic action there, which can do the work too, but i've disabled it.
What you need to make it work:
an ajax callback process, with the following line:
apex_util.set_session_state('P2_PAR_ENAME', apex_application.g_x01);
Give your report region a static id, i called mine 'report_emp'. This so i can easily retrieve it.
In the javascript region of the page, you then need to call the app process, and then refresh the region. Also bind the event which needs to trigger this action. I've done it here through the onchange event of the parameter textfield.
function refresh_report(oTrgEl){
//alert('refresh: ' + $v(oTrgEl));
//calling the application process which sets the session state of P2_PAR_ENAME
var oGet = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=set_session_state', &APP_PAGE_ID.);
oGet.addParam("x01", $v(oTrgEl));
oGet.get(); //the app process just sets something, it returns nothing
//refresh the report region
$("#report_emp").trigger("apexrefresh");
};
function bind_events(){
//call this onload
$("#P2_PAR_ENAME").change(function(){refresh_report(this);});
};
In the query of the report i use where ename like '%'||UPPER(:P2_PAR_ENAME)||'%'.
When you type (for example) 'bl' in, and tab out (to trigger the onchange), the region will refresh and will be filtered.
You'll just need to adapt to your solution :)