How to set and use session variables in pentaho CDE? - session-variables

I'm trying to use session variables in CDE. I use Startup Rule Engine to set the variables (althought I'm not sure if it really works, since I haven't been able to access these variables yet). I want to use these variables on the preExecution of a component in CDE. I have tried with ${[session:region]} (region is the name of the variable) but I only get the text itself (if I use console.log). I have also set a simple parameter (name:region value:${[session:region]}) but I get the same.
What's the way of doing this?

Assumption you are using MySQL database.
step1: Create one datasource
Name: username
Query: SELECT ${env::username}
Step2: Goto component panel and then select Select Component. Fill up below details.
Name: selectvalue
Query name: username
HtmlObject: username(these is HTML id eg: <html> <div id=username> </div> </html>)
step3: Save your dashboard run and see
Thank you

Related

APEX page process using a DB package

I am using APEX 5.1.4
Know this is probably one of those very easy answers - just not sure what script is used in a Page Process to call a DB package. Know I need to pass the parameters and call the specific part of the package - just not sure what that page process script should be.
Need to pass in the values from page 3 - :P3_USER_ID (which is the user's email address) and the :P3_PASSWORD. The DB package is called PSPRT_AUTH_PKG and the part of the package is CREATE_ACCOUNT. Thanks!!
Think I found the answer...
use this in the page processing as PL/SQL code...
psprt_auth_pkg.create_account(:P3_USERNAME, :P3_PASSWORD);
Something like (you'll need to correct my made-up parameter names):
PSPRT_AUTH_PKG.CREATE_ACCOUNT
( p_user_id => :P3_USER_ID
, p_password => :P3_PASSWORD
);

get value from one view & set it on element in another view in yii

I have a view file called "user" .There it has a select tag called 'uid'.I will select a user id from the select tag and click on 'add' button.When I click 'add' button it will redirect to another view called 'projects' . There I have a select tag called 'userID' I want to set the value of this option to 'uid' which I have selected in 'user' view. How can I do this?
I don't want to pass the variable in url
I have never worked on PHP but you can try one of the following options:
You can pass that value in URL and access it on project view.
eg: /project/uid=1001
Use can store on client side using Local Storage or Session Storage.
http://www.gwtproject.org/doc/latest/DevGuideHtml5Storage.html
You can also use Route Parameters:
Use following link: http://www.yiiframework.com/doc/guide/1.1/en/topics.url
Hope this might

use google tag manager custom HTML tag to populate data on pages

I have a question about gtm.
so currently I have created a script that can create all the data I need into datalayer this is how the data layer looks like (from page source code):
<script>
dataLayer = [{"visitorLoginState":"Logged out","visitorType":"NOT LOGGED IN","visitorLifetimeValue":0,"visitorExistingCustomer":"No"}];
</script>
but all this is generated from my store, but they key would be to be able to use these variables through GTM.
so inside GTM UI i created a custom html tag and added:
<script>
dataLayer.push({'event': 'visitorLoginState'});
</script>
I also created a custom macro->data layer variable with the name of "visitorLoginState" hoping that it would show "NO" instead of visitorLoginState in the response. but it just showing "visitorLoginState"
I am new to GTM too and getting to grips with it all.
From what I can see it looks like you are using macros and the dataLayer incorrectly.
You are running a script to add another row called event to the datalayer whilst already declaring what you want in the data layer. So initially the output in the source would be along the lines of:
visitorLoginState: Logged Out
visitortype: Not Logged In
ETC...
With the script you have added in GTM it would go to:
visitorLoginState: Logged Out
visitortype: Not Logged In
event: visitorLoginState
ETC
What you want to do is actually create a macro called visitorLoginState with the Type of Data Layer Variable, using the Data Layer Variable Name of visitorLoginState (and so forth).
From there you can create a Rule in GTM which will activate something based on what is returned in the data layer.
So your Rule could be:
visitorLoginState equals Logged out.
You could then have your script in the tags part of GTM which would say something like:
<script>
dataLayer.push({'event': 'No'});
</script>

How to use Global Property name in my JSON input request using SoapUI?

I have a SoapUI project which contains around 60 plus services. Each service requires some input which will be changed for every execution. So I have created certain Global Properties and assign some values to that properties.
I have to use these properties values in my SoapUI request ( i.e. JSON Format request ).
If it is groovy script means, I will use like this.
String HTiC_Username = com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['HTiC_Username'].value;
But, how to get the value of the Global Property in the request?
Hope you understand my question. Please provide proper guidance.
Thanks
To dynamically "expand" (i.e. substitute) the value of a property into a test step, the following syntax is used: ${#scope#propertyName}
...where 'scope' refers to the level at which the property has been defined (e.g. Global, Project, TestSuite, TestCase).
So to expand a property named username defined as a Global property, for example, the following code can be used directly within a Request Test Step (e.g within a JSON body, or header value, etc):
${#Global#username}
To access the same property value within a Groovy Test Step, you can use the following syntax:
context.expand('${#scope#propertyName}')
...as in the following example:
context.expand('${#Global#username}')
What we did was the following:
created a test data file to store all the specific input data for the different services (testdata.properties)
Example content of testdata.properties:
Billing_customerID=1234567
OtherService_paymentid=12121212
....
create a SoupUi global parameter (File/Preferences/Global properties): testdata_filepath=C:\...
For specific services we added a Properties test step. You can specify the "Load from" field to our new global parameter: ${#Global#testdata_filepath} Now you can use the Load button to load parameters.
Finally you can reference the parameter in your xml in the following format: ${Properties#Billing_customerID}
Example content of a service with parameter:
...
<BillingCustomerIdentification>
<BillingCustomerID>${#Properties#Billing_customerID}</BillingCustomerID>
</BillingCustomerIdentification>
...
To set up your projects in this manner also helps to automate service tests eg. using Hudson (see my previous SO answer).
If it is too heavy and automation is not a target, you can simply use ${#Global#someinputvariable} format in your xml ;-)

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 :)