How to pass a parameter to a declared function
Hello all
Can anyone help me with the following? I have a function which reads files and then adds the contents to a database. As some of the files are quite big I want to add them one at a time to the database. To do this I am passing a value from another page, if this value matches the filename then only that file will be loaded. I know I cannot use the request object to pass the value, as my function is declared, and I should pass the value as a param. Does anyone have any example code of how I can do this?
Thanks in advance for any help you can give me
elliemay
First, I would use a servlet instead of a JSP page, then I recommend using the "indexOf" method of the String object when you get the files name Array. If "indexOf(request.getParameter(Branch))" equals "-1", the file cannot be processed. Here is a quick example of a servlet doing the work (based on your code) :
package mypackage1;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ProcessFiles extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
File f = null;
PrintWriter out = null;
String sBranch = null;
String sPath = null;
String[] files = null;
response.setContentType("text/html; charset=windows-1252");
out = response.getWriter();
sBranch = request.getParameter("Branch");
// Check here if sBranch is not null
InitDB();
sPath = dbLookup("TEXT","T1_FILE_PATH");
// Check here if sPath is not null
f = new File(sPath);
files = f.list();
for (int i = 0; i < files.length; i++)
// Acting like a filter using the "indexOf" method of the String object on each item
if (files.length() == 15 && files[i].indexOf(sBranch) != -1)
ProcessFile(files[i], sPath);
DeleteFile(files[i]);
out.println("<html>");
out.println("<head><title>ProcessFiles</title></head>");
out.println("<body>");
out.println("<p>Files loaded</p>");
out.println("</body></html>");
out.close();
private void ProcessFile(String sFileName,String sPathPrefix) throws Exception
String record = null;
int RecCtr = 0;
final String EOR_DELIM = "*END*";
String sBranch = sFileName.substring(0,3);
String sRunDate = sFileName.substring(3,11);
final String InitSQL = "Insert into T1 values ('" + sBranch + "',";
String sSQL = InitSQL;
int i;
ExecSQLCmd("Delete from T1 where Branch='" + sBranch + "'");
try
FileReader fr = new FileReader(sPathPrefix + "/" + sFileName);
BufferedReader br = new BufferedReader(fr);
record = new String();
while ((record = br.readLine()) != null)
if (MyStrEquals(record,EOR_DELIM))
sSQL=ChopOff(sSQL,1) + ")";
ExecSQLCmd(sSQL);
RecCtr++;
sSQL = InitSQL;
else
StringTokenizer st = new StringTokenizer(record,"@");
i=0;
while (st.hasMoreTokens())
sSQL += ("'" + Escape(st.nextToken()) + "',");
i++;
catch (IOException e)
System.out.println("IOException error!");
e.printStackTrace();
throw e;
Similar Messages
-
How to pass dynamic parameter to a database function in OBIEE
Hi,
I have a requirement like this. I have to create one report in OBIEE which was in Discoverer. Now in discoverer report there are some calculated item in the worksheet based on database pkg.functions. The parameter which user gives at run time that parameters are then passed to the discoverer calculated items dynamically. But I am not able to do this in OBIEE answers.
Can anyone tell me step by step how I can able to pass the user selected parameter values in OBIEE answer level.
The example:
GET_COMM_VALUE_PTD("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id)
GET_COMM_VALUE_PTD --- Function database
("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id --- Parameters... :"Period Name(AFE)" is the dynamic parameter selected run time by user.
Please help.
Thanks
TitasHi,
I already did that. But the existing discoverer re value report is showing correct value but the OBIEE report with EVALUATE function shows incorrect value.
The requirement is to create a OBIEE Dashboard from a Discoverer existing report. Now in discoverer report theere are several calculated items in worksheet level where database custom function is used and user selected parameter value is passed run time in that function. But when that is created in OBIEE with EVALUATE function in RPD, the report shows incorrect data. Could not understand how to pass the parameter value runtime.
Below is the discoverer 'Show SQL' query and EVALUATE function syntax which has been used.
SELECT APPS.XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(XXBG_PL_PROJ_AFE_V.AFE_ID,
:"Period Name(AFE)",
XXBG_PL_PROJ_AFE_V.DATA_SEL,
XXBG_PL_PROJ_AFE_V.ORG_ID),
XXBG_PL_PROJ_AFE_V.AFE_DESC,
XXBG_PL_PROJ_AFE_V.AFE_NUMBER,
XXBG_PL_PROJ_AFE_V.APPROVED_AFE_AMOUNT
FROM APPS.PA_PERIODS_ALL PA_PERIODS_ALL,
APPS.XXBG_PL_PROJ_AFE_V XXBG_PL_PROJ_AFE_V
WHERE ((XXBG_PL_PROJ_AFE_V.ORG_ID = PA_PERIODS_ALL.ORG_ID))
AND (XXBG_PL_PROJ_AFE_V.DATA_SEL = :"Data Selection(AFE)")
AND (PA_PERIODS_ALL.PERIOD_NAME = :"Period Name(AFE)")
AND (XXBG_PL_PROJ_AFE_V.AFE_NUMBER = :"AFE Number(AFE)")
AND (XXBG_PL_PROJ_AFE_V.OPERATING_UNIT = :"Operating Unit(AFE)")
The EVALUATE function syntax is as below:
EVALUATE('XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(%1,%2,%3,%4)' AS FLOAT , "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Afe Id", "BG PL Project Analysis Report_1"."Periods 1"."Periods 1.Period Name", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Data Sel", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Org Id")
The PERIOD needs to be passed at run time which user will select.
Please help to solve the issue. -
How to Pass Multiple Parameter to Discoverer Custom Folder Created in Admin
Hi,
I have done as describe in doc id (metalink) note 304192.1 and it's ok.
Now, my scope is to use the parameter declared in SETPARAMS not with the "=" condition but with "IN CLAUSE" (multipe values).
for example (SQL Inspector):
SELECT i106116 as E106116,i106117 as E106117,SUM(i106118) as E106118_SUM
FROM ( SELECT DS_COMMESSA AS i106116, DS_SCENARIO AS i106117, DS_VALUE AS i106118 FROM (select ds_commessa, ds_scenario, DS_VALUE
from dw_ods.ods_mbo_commessa
where DS_TIPO_COSTO='COSTI MEDI'
and ds_label='DIR'
and cd_scenario in (1,2)
and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
union all
select 'Totale' as ds_commessa, ds_scenario, sum(DS_VALUE)
from dw_ods.ods_mbo_commessa
where DS_TIPO_COSTO='COSTI MEDI'
and ds_label='DIR'
and cd_scenario in (1)
and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
group by ds_scenario
) CUO106102 ) o106102
WHERE (1 IN (DW_ODS.SETPARAM.SET_PARAM1(:"Commessa")))
GROUP BY i106116, i106117;
where the parameter "commessa" is used with "IN" operator.
Also tried to modifiy the SET_PARAM1 and GET_PARAM1 in order to use a "table of varchar2" ... but with no succes.
Help pleaseRod,
for the first "problem" I find the solution on metalink (note 304192.1) and works fine (also combining SET and GET together)... otherwise I don't know how use this "workaround"...
for the multiple values on a single parameter (for example: Month='Jan,'Feb') I have tried to understand how DISCO pass these values to the SET function (I suppose like an array of varchar2) but don't work. After the first values (Jan) the reports stop... The problem in not how stored the values but understan how DISCO "pass/manage" these values (Jan,Feb)... Can u help me?
my actual SETPARAMS package body is (like metalink):
CREATE OR REPLACE PACKAGE BODY SETPARAM AS
FUNCTION SET_PARAM1(P1 IN VARCHAR2) RETURN NUMBER IS
BEGIN
param1 := P1;
return 1;
END;
FUNCTION GET_PARAM1 RETURN VARCHAR2 AS
BEGIN
return param1;
END;
FUNCTION SET_PARAM_MBO(p_anno IN VARCHAR2) RETURN NUMBER IS
BEGIN
anno := p_anno;
return 1;
END;
FUNCTION GET_PARAM_MBO RETURN VARCHAR2 AS
BEGIN
return anno;
END;
END SETPARAM;
---------------------------------------------------------------------- -
How to pass the parameter of a stored procedure to iReport
Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
In the Report Query, i tried
1. sp_storedprocedure ' value'
2. sp_storedprocedure +''''+$P{parameter}+''''+
3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank youFor M$ SQL server I find that it only works when U use the fully qualified name...
e.g. catalod.dbo.my_procedure_name 'variable'
My full query in the Report Query window is something like this:
EXEC arc.dbo.jasper_Invoice 1000
Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
CREATE PROC jasper_MyProc (@my_rec_id integer) AS
SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
...to wrap your SELECT statement, then call the PROC
Edited by: Sylinsr on Apr 22, 2008 4:23 PM -
How to pass Cascading Parameter in SSRS using Java
How to pass Cascading Parameter in SSRS using Java---
We are having a problem with dependent parameters.There are three drop down--
1.first dropdown is of Country.When we select a country--Accordingly next dropdown(State)will populate
2.Second dropdown is of State. When we select a state--Accordingly next dropdown(City)will populate.
I have three data sources are
CountryList-
SELECT CountryRegionCode, Name
FROM Person.CountryRegion
ORDER BY Name
StateList
SELECT StateProvinceID, StateProvinceCode, CountryRegionCode
FROM Person.StateProvince
WHERE CountryRegionCode = @CountryRegionCode
ORDER BY StateProvinceCode
CityList
SELECT StateProvinceID, City
FROM Person.Address
GROUP BY StateProvinceID, City
HAVING (StateProvinceID = @StateProvinceID)
ORDER BY City
Ihave to show report that has been deployed on server on the besis of these parameters
I am using ReportViewer in JSP Page through url--
http://192.168.90.149/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project1%2fCascading_Parameters&rs:Command=Render&rs:parameter=true&Country="+Country+"&State="+State;
But it is not accepting parameter if they are cascaded.It is working fine if Both parameters are independent.
Edited by: kaushlee on May 11, 2010 9:22 PMTake a look at set_custom_property:
public static final ID SETTEXT = ID.registerProperty("SETTEXT");
public boolean setProperty(ID pid, Object value)
if (pid == SETTEXT)
String text = value.toString();
and in forms
set_custom_property('beans.bean_item', 1, 'SETTEXT', 'some text');
cheers -
How to pass a parameter from one action1 in block1 to action2 in block2.
Dear Experts,
How to pass a parameter from one action1 in block1 to action2 in block2.
My Process Structure is as follows..
Process
Sequential Block
Action 1
Parallel Dynamic Block
Sequential Sub Block
Action 2.
while i am trying to execute the action1 the following error is shown below:
Cannot complete action: The activity could not be read.
Please suggest me how to do?
Regards,
Rajesh NHello Rajesh!
I think you are talk about the mapping parameters of your process.
This case in design time of your workflow, you have the vision of your blocks and actions, you have on action 1 the output parameter and you have the action 2 an input parameter.
So you have that make a group mapping on your process, map in this group the action1 outpu parameter with the action2 input parameter.
Regards, Ronaldo Rampelotti -
How to pass a parameter into execute sql task and later use it into dataflow task?
i am in a situation, where i have a logging table in which i have a primary key called ETL_log_ID which is an identity column and acts as a foreign key for various fact table and dimension tables which are populated using SSIS packages. Now i wanna use the
ETL_log_ID as a parameter in the execute sql task which populates the log table and pass the same value in the data flow task which populates the facts and dimension. Can you let me know how to pass the parameter in a step by step procedure.
Thanks,
Nikhil
Nikhil,
You can check the following :
http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx
http://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis
Regarding the usage in Dataflow task, Can you elaborate on that a little?
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
How to pass Stages Guid dynamically in declarative workflow
hello,
How to pass Stages Guid dynamically in declarative workflow.
Example For List we used to pass guid like this
System.Guid.Parse("{$ListId:Lists/Testlist;}")
help me out to pass stage guid...
any help would be appreciated!!!!
Thanks regards, Vignesh.You need to make use of command line arguments. You can go through this link for example.
http://www.freeos.com/guides/lsst/ch02sec14.html
In your shell script(say test.sh) you can have
exp fas/xxxxxx@fasbd001 file=audit_grn_28aug.dmp tables=audit_grn query=\"where org_grp_i=$1 \"$1 indicates it accepts the first argument from command line. if you want to pass 19, add that next to the script you're executing.
From command line you can call this shell script say test.sh 19 -
How to Pass multiple parameter into single store procedure
How to Pass multiple parameter into single store procedure
like a one to many relationship.
it is possible then reply me immediatlyyou mean like this .....
CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
BEGIN
DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
END display_me;
CREATE OR REPLACE procedure display_me_2 as
cnt integer :=0;
BEGIN
For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
display_me(in_param => c1_rec.empno);
cnt := cnt+1;
end loop;
DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
END display_me_2;
SQL > exec display_me_2
Values is .....9999....Default
Values is .....4567....Default
Values is .....2345....Default
Values is .....7369....Default
Values is .....7499....Default
Values is .....7521....Default
Values is .....7566....Default
Values is .....7654....Default
Values is .....7698....Default
Values is .....7782....Default
Values is .....7788....Default
Values is .....7839....Default
Values is .....7844....Default
Values is .....7876....Default
Values is .....7900....Default
Values is .....7902....Default
Values is .....7934....Default
Values is .....1234....Default
Total record count is ....18 -
How to pass page parameter to report portlet ?
Portal: 9.0.4
RDBMS: 9.0.1.5.0
OS: Windows
REF: How to pass page parameter to report portlet ?
Hi,
I create a Oracle Report as a Portlet in Portal (create Report Definition File Access and check on the option "Publish As Portlet" in the on the last step). My report has an "Additional User Parameter" and I has let it "Visible to user".
When I put this portlet in my Portal page, I can see this parameter in the property/parameters of this page. However I cannot transfer my page parameter to this portlet parameter. Other portlets in this page (non-Oracle-Report portlets) are working fine with my page parameter.
Please advice.I want to make sure we are talking about the same thing:
After you add the portlet to the page, you go to the page properties, then the parameters tab, then there is a section at the bottom called "Portlet Parameter Values" where you can click and expand your portlet to see your portlet parameters.
Is it here where your parameters just don't show up?
If it is, try the following:
- Add the portlet to another page and see if it still behaves the same.
- Mark the parameters in the portlet as being non-public, re-generate portlet (on manage tab), then mark them as being public, re-generate and then try the above again (add to another page). -
How to pass IN parameter as BOOLEAN for concurrent program in Apps(Environ)
hi all
i am using a standard package procedure,where in which i need to pass some parameters to a procedure,
some of the parameters there are BOOLEAN type ,can anybody help me to know , How to pass IN parameter as BOOLEAN for concurrent program in Apps(Environ)Already answered this on the SQL forum (How to give IN parameter as BOOLEAN in a concurrent program.
-
How to pass a parameter with more than one value to a report? (urgent)
Hi, all
I try to pass a parameter from a search form to a report in
which I would like to print out my search result. My problem is
I can pass the parameter to report but only one value which my
cursor points to. could anyone tell me how to pass a list of
value to the report? my trigger in form like this:
declare
PL_ID PARAMLIST;
sc_no books.c_no%type;
begin
PL_ID := GET_PARAMETER_LIST('parametername');
IF NOT ID_NULL(PL_ID) THEN
DESTROY_PARAMETER_LIST(PL_ID);
END IF;
PL_ID := CREATE_PARAMETER_LIST('parametername');
IF ID_NULL(PL_ID) THEN
MESSAGE('PL/SQL held against Button failed to execute');
RAISE FORM_TRIGGER_FAILURE;
END IF;
ADD_PARAMETER(PL_ID, 'PARAMFORM', TEXT_PARAMETER,'NO');
sc_no := :searchlist.c_no; --(c_no is the value I want to pass
but not only one.)
ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
RUN_PRODUCT(REPORTS, 'reportpathname.rep', SYNCHRONOUS, RUNTIME,
FILESYSTEM, PL_ID, NULL);
end;
Thank you in advance
DianaIs it your values in parameter NO separated by coma? And is it
parameter in where clause?
Do you want something like :
from table
where s_no in (NO) ?
If is answer "yes" you can create lexical parameter in report.
You can write in report sowething like:
select a.field1, a.field2,.....
from table a
&COND /* this is if is condition only one line after "from".
if you have more lien after where then you will put this &COND
in line where you want to have your multivalue.
Then in your trigger in form you should write:
sc_no := 'where a.sc_no in ('||:searchlist.c_no||')';
ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
/* again this is if you have only one line with WHERE ili
conditions */
or you will write:
sc_no := 'and a.sc_no in ('||:searchlist.c_no||')';
ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
It will substitute line in which is your conditions with
multivalue. -
Extremely URGENT! How to pass a parameter from html to form?
Hi Guys,
I want to be able to pass a parameter to a Pre-Query trigger (from a html page to an Oracle form.) Right now, I hard coded the Pre-Query trigger
(i.e. set_block_property('datablock_name', default_where, 'tableName.fieldName = '||:datablock.field)
I want to be able to assign a value to the above datablock.field from an URL (i.e. something like http://localhost/dev60cgi/ifcgi60.exe?form=MODULE1.fmx&userid=&otherparams=fieldx=parameterSample
Does anyone know how to set that up within Oracle Forms. Thanks in advance.Hello. your you can create one it paginates similar to this...
<HEAD></HEAD>
<BODY >
<!-- Forms applet definition (start) -->
<OBJECT classid="clsid:86ecb6a0-400a-11d5-b638-00c04faedb18" codebase="/jinitiator/jinit.exe#Version=1,1,8,11" WIDTH="950" HEIGHT="560" HSPACE="0" VSPACE="0">
<PARAM NAME="TYPE" VALUE="application/x-jinit-applet;version=1.1.8.11">
<PARAM NAME="CODEBASE" VALUE="/forms60java/">
<PARAM NAME="CODE" VALUE="oracle.forms.engine.Main" >
<PARAM NAME="ARCHIVE" VALUE="f60all_jinit.jar, ComponentesEsigfa.jar" >
<PARAM NAME="serverPort" VALUE="9000">
<PARAM NAME="serverHost" VALUE="MyServer">
<PARAM NAME="serverURL" VALUE="/servlet/oracle.forms.servlet.ListenerServlet?ifcfs=/servlet/f60servlet?config=servlet&form=fca_menu.fmx&otherparams=ejercicio=<%=request.getParameter("ejercicio")%>&useSDI=yes&lookAndFeel=generic&colorSchema=teal">
<PARAM NAME="connectMode" VALUE="HTTP">
<PARAM NAME="serverArgs"
VALUE="module=fca_menu.fmx userid=<%= request.getParameter("login")+"/"+request.getParameter("pwd")+ "@" +request.getParameter("base")%> ejercicio=<%=request.getParameter("ejercicio")%>">
<PARAM NAME="separateFrame" VALUE="false">
<PARAM NAME="splashScreen" VALUE="no">
<PARAM NAME="backgroun[i]Long postings are being truncated to ~1 kB at this time. -
How to pass a parameter into a select statement using a bulk collect
Using a cursors I can use execute immediate to pass a parameter to specify a table name.
I have modified the procedure not to use the cursor. I am using a collection using a bulk insert into a nested table. How can I specify the table the table name as a parameter without using the execute immediate statement.
Thank youHi Donald,
The functionality of using a parameter in a function is only available in the formula editor and not in SQL Expression. Parameters cannot be passed to the SQL Expression, the main purpose of the SQL Expression is to make use of Database functions to make calculations at the database level but the current functionality of the product only allows you to use Database fields.
There is an article that talks on SQL Expressions and can be useful http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016184&sliceId=&dialogID=6018612&stateId=1%200%206020316
Regards,
Vinay -
How to pass a parameter into a sql expression?
How to pass a report parameter into a sql expression?
Hi Donald,
The functionality of using a parameter in a function is only available in the formula editor and not in SQL Expression. Parameters cannot be passed to the SQL Expression, the main purpose of the SQL Expression is to make use of Database functions to make calculations at the database level but the current functionality of the product only allows you to use Database fields.
There is an article that talks on SQL Expressions and can be useful http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016184&sliceId=&dialogID=6018612&stateId=1%200%206020316
Regards,
Vinay
Maybe you are looking for
-
I have restarted my computer and uninstalled and re-installed firefox and it still doesnt work. i also had a trojan virus when firefox stopped working
-
How to pass column header as a parameter in Validation Expression (APEX4.0)
Hello I created a new Page validation in APEX4.0 ( not 4.1 ). (1) Type : Function Returning error text (2) Validation Expression 1 : begin return validate_name ( p_c=> #COLUMN_HEADER# ,p_c_value=> to_date(:p26_LEAVE_FROM,'dd/mm/yyyy') ); end; note: t
-
Yosemite server: no CardDAV-Sync with Yosemite clients
Hi everybody, this drives me really mad: We had a Lion server (older Mac mini) with Calendar and Contacts services running with no issues. We used global accounts to share company's events and contacts between Macs and iOS devices. We started using Y
-
Google map full screen in lion
How do I get the actual map area to occupy full screen
-
Manually reopening a queue when it is scheduled as closed.
Hello everyone, I am trying to figure out how had add in a variable or a step in one a my call centers. there is a scheduled time on Wednesdays when our call center is "closed for training" and they would like to have the option of remainin