How to reterive content using dynamic query through content repository
Hello,
i am reteriving content from content repository,using following tag:
<pz:contentQuery query="PPF_Type='Forms' && SupportGroup='HR'" sortBy="cm_modifiedDate" max="5" id="HRForms"/>
where SupportGroup='HR/IT/Finance'
How can I get property value dynamically without hardcoding like above,instead i want it as follows:
String formQuery="PPF_Type='" + typeName + "' && SupportGroup='" + groupName + "'";
How can i get 'typeName' and 'groupName' as variable through jpf,if i have to display titles in same page.
Hello,
i am reteriving content from content repository,using following tag:
<pz:contentQuery query="PPF_Type='Forms' && SupportGroup='HR'" sortBy="cm_modifiedDate" max="5" id="HRForms"/>
where SupportGroup='HR/IT/Finance'
How can I get property value dynamically without hardcoding like above,instead i want it as follows:
String formQuery="PPF_Type='" + typeName + "' && SupportGroup='" + groupName + "'";
How can i get 'typeName' and 'groupName' as variable through jpf,if i have to display titles in same page.
Similar Messages
-
How to use dynamic query for Result table
Hello Experts,
I want to use dynamic query and then display the result in the assignment block.
Using dynamic query BTQAct and BTQRAct and base on some search criteria i want tofilter and then append the result in the result table of that custom context node, and then it should display the result in the view in UI.
SO can you please provide me the samplle code on how to use the dynamic query and append in the result table.
Regards.Hi,
Please find below sample code:
data: query TYPE REF TO cl_crm_bol_dquery_service,
result TYPE REF TO if_bol_bo_col.
DATA: lt_params TYPE crmt_name_value_pair_tab,
lwa_params TYPE crmt_name_value_pair.
query = cl_crm_bol_dquery_service=>get_instance( 'BTQAct' ). " Get instance of dynamic query
Set general query parameter for maximum number of hits
lwa_params-name = 'MAX_HITS' .
lwa_params-value = '50'.
APPEND lwa_params TO lt_params.
query->set_query_parameters( it_parameters = lt_params ).
query->add_selection_param( iv_attr_name = 'OBJECT_ID'
iv_sign = 'I'
iv_option = 'EQ'
iv_low = <lv_objectid>
iv_high = '' ). " Set your search criteria. Repeat this code if you have multiple parameters
"You can find possible search options for a query object in GENIL_BOL_BROWSER
result ?= query->get_query_result( ). " Get result from your search query
me->typed_context-> <your result context node>->set_collection( result ).
Here you will have to create a context node in your view which would refer to query result object like for BTQAct its BTQRAct
Hope this helps.
e Regards,
Bhushan -
How to use three part name with using dynamic query.
Dear all, (sqlserver 2008 express r2)
q1)following is showing error, is it possible to accomplish the task with out using dynamic query.
DECLARE @A VARCHAR(100)
DECLARE @A1 VARCHAR(100)
SET @A='DB1'
SET @A1='DBO'
SELECT * FROM @[email protected]
q2) table value function is not accepting dynamic query , is there any way to do this task.
yours sincerleyCertain parts in an SQL query like FROM tablename cannot be local variables. In such a case, dynamic SQL can be applied:
http://www.sqlusa.com/bestpractices/dynamicsql/
As noted above, more information needed to decide if dynamic SQL the correct solution in this instance.
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Finding minimum value in each row using dynamic query
need to find the minimum and maximum value from each row using dynamic query
[from curr] will be given as input
TukyDECLARE @t TABLE(a INT,b INT,c INT);
INSERT @t VALUES(1,2,3),(9,8,7),(4,6,5);
SELECT *
, ( SELECT MAX(val)
FROM (VALUES (a)
, (b)
, (c)
) AS value(val)
) AS MaxVal
, ( SELECT MIN(val)
FROM (VALUES (a)
, (b)
, (c)
) AS value(val)
) AS MinVal
FROM @t;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Converting rows to columns using dynamic query.
I am trying to use the below code that I founnd on the web to conver rows to columns. the reason that I want to use dynamic query is that the number of rows are not know and changes.
declare
lv_sql varchar2(32767) := null ;
begin
lv_sql := 'SELECT Iplineno ';
for lv_rec in (SELECT distinct vendor from bidtabs where letting = '10021200' and call ='021')
loop
lv_sql := lv_sql
|| CHR(10)
|| ', MAX( DECODE( vendor, '
|| chr(39)
|| lv_rec.vendor
|| CHR(39)
|| ', bidprice, NULL ) ) as "'
|| lv_rec.vendor
|| '" ' ;
end loop;
lv_sql := lv_sql
|| CHR(10)
|| 'FROM bidtabs where letting = ''10021200'' and call = ''021'' and lineflag = ''L'' '
|| CHR(10)
|| 'GROUP BY iplineno ;' ;
here is the result
BIDPRICE CALL IPLINENO LETTING VENDOR
9,585 021 0010 10021200 C0104
1,000 021 0020 10021200 C0104
1,000 021 0030 10021200 C0104
17 021 0040 10021200 C0104
5 021 0050 10021200 C0104
11,420 021 0010 10021200 K0054
1,100 021 0020 10021200 K0054
1,100 021 0030 10021200 K0054
5 021 0040 10021200 K0054
3 021 0050 10021200 K0054
8,010 021 0010 10021200 V070
900 021 0020 10021200 V070
1,320 021 0030 10021200 V070
11 021 0040 10021200 V070
3 021 0050 10021200 V070
and here is the desired output
CALL IPLINENO LETTING C0104 K0054 V070
021 0010 10021200 9,585 11,420 8,010
021 0020 10021200 1,000 1,100 900
021 0030 10021200 1,000 1,100 1,320
021 0040 10021200 17 5 11
021 0050 10021200 5 3 3Here is the error message I am getting:
RA-06550: line 22, column 43:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe -
How to use dynamic query for this ??
hi , i am new to ABAP. i got a requirement to write dynamic query for the following code.
kindly address. two set of queries are same.but condition is different.
.IF p_psd EQ ' '.
*C--End of change DF 1232137- (Transport # :CIDK980530 )
*C--FETCH THE Deliverd Quantiity and Material Number
SELECT aufnr "ORDER number
wemng "Quantity of goods received for the order item
matnr "MATERIAL NUMBER
pwerk "PLANT
dauat "Order Type
FROM afpo
INTO TABLE t_afpo
WHERE aufnr IN s_order
AND wemng IN s_dqt
AND matnr IN s_matnr
AND pwerk IN s_plant
AND dauat = c_ro.
IF sy-subrc = 0.
SORT t_afpo BY aufnr matnr pwerk.
*C--FETCH THE OBJECT NUMBER
SELECT aufnr "ORDER number
objnr "Object number
FROM aufk
INTO TABLE t_aufk
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr.
IF sy-subrc = 0.
SORT t_aufk BY aufnr objnr.
*C--FETCH THE Target Quantiity
SELECT aufnr "ORDER number
gamng "Total order quantity target quantity
FROM afko
INTO TABLE t_afko
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr
AND gamng IN s_tqt.
IF sy-subrc = 0.
SORT t_afko BY aufnr .
ENDIF.
ENDIF.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
*C--Begin of change DF 1232137- (Transport # :CIDK980530 )
ENDIF.
IF p_psd EQ c_x.
SELECT aufnr "ORDER number
wemng "Quantity of goods received for the order item
matnr "MATERIAL NUMBER
pwerk "PLANT
dauat "Order Type
FROM afpo
INTO TABLE t_afpo
WHERE aufnr IN s_order
AND wemng > 0
AND matnr IN s_matnr
AND pwerk IN s_plant
AND dauat = c_ro.
if sy-subrc = 0.
*C--FETCH THE OBJECT NUMBER
IF NOT t_afpo[] IS INITIAL.
SORT t_afpo BY aufnr matnr pwerk.
SELECT aufnr "ORDER number
objnr "Object number
FROM aufk
INTO TABLE t_aufk
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr.
IF sy-subrc = 0.
SORT t_afko BY aufnr gamng.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF NOT t_afpo[] IS INITIAL.
*C--FETCH THE Target Quantiity
SELECT aufnr "ORDER number
gamng "Total order quantity target quantity
FROM afko
INTO TABLE t_afko
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr
AND gamng <> t_afpo-wemng .
IF sy-subrc = 0.
SORT t_afko BY aufnr gamng.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
Edited by: Thomas Zloch on Jan 5, 2011 1:30 PM please use code tagsHi friend,
Try using MACRO and dynamic WHERE condition.
Group simialr Select statements under a Macro.
Build a dynamic where by checking conditions
Call macro passing dynamic where condition.
TABLES afpo.
DATA: str TYPE string.
*Macro definition
DEFINE operation.
select single *
from afpo into afpo
where (&1). " Dynamic condition
END-OF-DEFINITION.
*Build dynamic WHERE by checking some conditions
*If conditon
CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0001''' INTO str SEPARATED BY space.
*Else
CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0002''' INTO str SEPARATED BY space.
*Endif.
*Call Macro passing dynamic WHERE condition
operation str. -
Ref Cursor Using Dynamic Query
Hi,
I need to use the ref cursor to fetch result from dynamic query.
e.g.
Open ref_test_tbl for Select * from tbl1 where tbl1.field1= :1
and tbl1.field2 =:2 using i_v1,i_v2;
The thing is i_v1, i_v2 are dynamic.
i.e. using clause can include i_v3, i_v4 also.
How to include dynamic variables in the using clause.
thanks> How to include dynamic variables in the using clause.
Cannot using a ref cursor.. (and anyone that post code that writes dynamic PL/SQL in order to achieve this, I will call an idiot).
What you should be using in PL/SQL is a DBMS_SQL cursor. This allows you to create a fully dynamic SQL statement with bind variables. E.g.
select * from tbl1 where col1 = :1
select * from tbl1 where col2 = :1 order by 2
select * from tbl1 where col3 between :0 and :1
Using this dynamically created SQL statement, you can parse it using DBMS_SQL, determine the number of bind variables, and bind each of these dynamically.
You can then execute the SQL and again, dynamically, determine just what the projection of the cursor is. How many columns are returned, their names, data types, precision and so on.
This is what APEX (see http://apex.oracle.com) use extensively in order to run SQLs and render these as reports - all dynamically.
DBMS_SQL is detailed in the [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#BABEDAHF]Oracle® Database PL/SQL Packages and Types Reference manual. -
How to create and use dynamic queue in JMS
Plz tell me how to create and use a dynamic queue in jms and can reciever file lookup it as it lookup any server configurred queue(written in the server).
Hi,
We can use Azure File services to do this, for more information, please have a look at this article:
http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx. The Azure File service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between
VMs using standard and familiar file system APIs like ReadFile and WriteFile.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Help! Inaccessible iterator when using dynamic query
Hi!
I have a problem retreiving results from a dynamic query into sqlj iterator.
I consulted the Oracle App Dev Guide and Oracle SQLJ Dev Guide and wrote the following code:
<PRE>
package pmServer;
#sql iterator LocIterator (int id, String name);
public class pmRISDImpl
public int GetLocations(...)
LocIterator locIt;
String q = "select ID, NAME from PMADM.LOCATIONS";
#sql
BEGIN
open :OUT locIt for :q;
END;
</PRE>
When I try to compile it using tools provided by JDeveloper ver 3.2.2.(Build 915) for JDK 1.2.2 I get error for #sql statement:
Inaccessible Java type for host item locIt (at position #1): pmServer.LocIterator
and warning:
Type pmServer.LocIterator of host item locIt (at position #1) is not permitted in JDBC. This will not be portable.
Althow the code is identcal to those demonstrated in Oracle document "Oracle8 i
SQLJ Developers Guide and Reference
Release 3 (8.1.7)
July 2000
Part No. A83723-01" pp 12-67 (PL/SQL in SQLJ for Dynamic SQLDynamicDemo.sqlj). There it looks like
<PRE>
private static void dynamicSelectMany(String what_cond)
throws SQLException {
System.out.println("dynamic multi-row query on table emp");
Employees empIter;
// table/column names cannot be bind args in dynamic PL/SQL, so
// build up query as Java string
String query = "select ename, sal from emp " +
(((what_cond == null) | | (what_cond.equals(""))) ? "" :
(" where " + what_cond)) +
"order by ename";
#sql {
begin
open :OUT empIter for -- opening ref cursor with dynamic query
:query;
-- can have USING clause here if needed
end;
while (empIter.next()) {
System.out.println("Employee " + empIter.ename() +
" has salary " + empIter.sal() );
empIter.close();
</PRE>
Please guide me what should I do to get it working.
nullIn the CAST statement the SQLJ runtime must be able to produce an instance of you SQLJ iterator using Java reflection.
This necessitates that the iterator class must be accessible by public.
You have two options:
(1) Declare the iterator public. This requires that you put it in its own file LocIterator.sqlj:
#sql public iterator LocIterator (int id, String name);
(2) Declare the iterator as an inner class. In this case you want to make it public static (that is it does not require an instance of the outer class in scope). You might write the following.
package pmServer;
public class pmRISDImpl
#sql public static iterator LocIterator (int id, String name);
(3) If you are using Oracle 9i you have another option. You can embed dynamic SQL fragments directly in your SQLJ code and do not need to use the CAST:
public int GetLocations(...)
LocIterator locIt;
String q = "PMADM.LOCATIONS";
#sql locIt = { select ID, NAME from :{q} }; // Note new syntax :{q} for embedding SQL source code
} -
Create table problem using Dynamic Query
Hi all,
I want to create a temporary table within a stored procedure so I decided to do it using a dynamic query:
create or replace procedure p1
as
begin
execute immediate 'CREATE GLOBAL TEMPORARY TABLE tt(id number(2))';
end;
/ It created successfuly but when I execute that procedure I got:SQL> exec p1;
BEGIN p1; END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.P1", line 4
ORA-06512: at line 1 While I can create that table using the same user without any problem!
My question is:What privilege should I grant to user(minimum of privileges please! ) to execute that procedure successfuly?
-ThanksHi,
To say a little bit more about Nicolas' answer:
SQL> grant create table to scott;
This is the right answer, but you might wonder why you have to do so if you usually can create tables with this user..
11:59:19 TEST.SQL>CREATE USER UTEST
11:59:28 2 IDENTIFIED BY UTEST;
User created.
11:59:35 TEST.SQL>CREATE ROLE RTEST;
Role created.
11:59:40 TEST.SQL>GRANT RTEST TO UTEST;
Grant succeeded.
11:59:45 TEST.SQL>GRANT CREATE SESSION TO RTEST;
Grant succeeded.
11:59:54 TEST.SQL>GRANT CREATE TABLE TO RTEST;
Grant succeeded.
12:00:03 TEST.SQL>GRANT UNLIMITED TABLESPACE TO UTEST;
Grant succeeded.
12:00:17 TEST.SQL>CREATE PROCEDURE UTEST.CT_TEST
12:00:32 2 IS
12:00:33 3 BEGIN
12:00:35 4 EXECUTE IMMEDIATE 'CREATE TABLE UTEST.TTEST (A NUMBER)';
12:00:56 5 END;
12:00:58 6 /
Procedure created.
12:00:59 TEST.SQL>EXEC UTEST.CT_TEST;
BEGIN UTEST.CT_TEST; END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "UTEST.CT_TEST", line 4
ORA-06512: at line 1
12:01:06 TEST.SQL>GRANT CREATE TABLE TO UTEST;
Grant succeeded.
12:01:15 TEST.SQL>EXEC UTEST.CT_TEST;
PL/SQL procedure successfully completed.Don't forget that when you're using PL/SQL, privileges granted via roles are ignored!
Regards,
Yoann. -
Using Dynamic Query in For Loop
I have a doubt whether i can use the result from dynamic query in the for loop.
for example,
declare
v_sql varchar2(1000);
v_Id INTEGER;
begin
v_sql := 'select id from table1 where id in ('||v_Id||')';
FOR i in vsql LOOP
dbms_output.put_line(i.id);
end loop;
end;
The above query is possible ?And here's a basic example of opening up a cursor for your dynamic query...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_sql varchar2(2000);
3 v_cur sys_refcursor;
4 i emp.sal%type;
5 begin
6 v_sql := 'select sal from emp';
7 open v_cur for v_sql;
8 loop
9 fetch v_cur into i;
10 exit when v_cur%NOTFOUND;
11 dbms_output.put_line('Salary: '||i);
12 end loop;
13* end;
SQL> /
Salary: 800
Salary: 1600
Salary: 1250
Salary: 2975
Salary: 1250
Salary: 2850
Salary: 2450
Salary: 3000
Salary: 5000
Salary: 1500
Salary: 1100
Salary: 950
Salary: 3000
Salary: 1300
PL/SQL procedure successfully completed.
SQL> -
Using Bex query through Query Browser - add result set to Cell range?
Hi all,
I have up to now used Xcelsius on NW with BICS connection towards BEx queries.
When I use this connection via Data Manager in Xcelsius, I'm able to use the Cross-table functionality to insert my entire dataset into a cell Range.
But now I have an requirement to save my Dashboards on the BO server, so I need to go through Query Browser to extract data from SAP BW to my Dashboard.
When inserting the query in the Query browser and I want to assign the data to Excel ranges, it seems like I need to do this for each individual Infoobject and Key Figure. Since I have many Key Figures (30-50), this is a lenghty process.
Is there a way to insert the entire dataset from Query into a cell range (both rows and columns), or do I need to do this for each Key Figure as indicated in the screen shot above?
--> I know that the Query Browser flattens my cross-table from the Query, but still, it should be possible to avoid to input all my Key Figures (30-50) individually to corresponding cells in my Excel part of the Dashboard.
regards
Oddmar Lid
asdfasfHi Oddmar,
If you want to display the data retrieved from the query you could map the data using the Query data.
Pull scorecard component (for example) and in properties if you see the Display data click on the dropdown and select Query data.
Hope this helps ! -
How to numberformat when using sql:query alogn with c:forEach JSTL tags
Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
Here is my jsp code
<sql:query..../>
<c:forEach var="row" items="${queryResults.rows}">
<tr>
<td><c:out value="${row.COL1}" /></td>
<td><c:out value="${row.COL2}" /></td>
</tr>
</c:forEach>
Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
how can i format them to 1,000 , 10,1000 , 100,000 etcIt is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
I presume you discovered the JSTL <fmt:formatNumber> tag? -
How to backup database using sql query?
Hello,i'm student, i'm researching oracle database,i want to backup database that using sql query (like backup query in SQL SERVER) ,how to do that ??
Thank!No, database backups cannot be done from within the database.
Commands for backups are outside of the database.
See the "2 Day DBA Guide" http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/toc.htm
and the "Backup and Recovery Users's (actually Adminsitrator's) Guide : http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/toc.htm
Hemant K Chitale -
How to set hostname using dynamic binding for FTP, AQ, SMTP adaptersin BPEL
I am using Oracle BPEL and SOA 11g and my requirement is to send files and messages to different destinations ( hostname ) using dynamic JCA bindings. All hostname to be used other related information for destination is stored in database. My BPEL flow should retrieves the hostnames using one webservice and then set the hostname in FTP, AQ and SMTP adapters using dynamic JCA bindings.
I came across http://rahullahiri.blogspot.in/2011/09/configuring-ftp-adapters-in-oracle-soa.html and http://www.soabyte.com/2010/11/jca-dynamic-partnerlinks-in-soa-11g.html but unsure if we can dynamically set the hostname also for the adapters mentioned in the BPEL flow.
Can you please advice how it can be achieved in BPEL and what is the best way?
Thanks for help in advance.
ShailHi,
Its good that u pasted the complete log file. In your environment you have to run this upgrade tool only once from any of the middle tier.
And with respect to your error that u got in precheck is quite simple. All u have to do is just run this script from by connecting to portal schema using sqlplus.
Run dropupg.sql
Location-------- /raid/product/OraHome_1/upgrade/temp/portal/prechktmp/dropupg.sql
Later you re-run the upgrade tool and let me know the status.
Good luck
Tanmai
Maybe you are looking for
-
Error while creating/changing/desplay cost element
Gents Need urgent help. I am getting a below error while creating/changing/Displaying the cost element. Table CI_CSKB is not an active table Message no. AD 228 Kindly help me to get the resolve this issue. Thanks and Regards Vinay Thakre
-
Selection screen variant...
Hi Gurus, My requirement is I need to call a prepare a selection screen and create a variant of that screen.. Then user will put the name of the variant as selection id in "Production Planning run " screen...I neeed to fetch all product ids based on
-
TMS_TM_GET_TRLIST and RFC error
Hello, I am having problem with RFC call to TMS_TM_GET_TRLIST. Since this function is not remote enabled, I copied it and made it remote enabled. Function works well from SAP but when I call it from PHP, I get: Errors found during saprfc calls: RFC E
-
NullpointerException in SoapUI.jar
Hi . I'm facing below null pointer exception sometimes. 2012-04-12 09:01:09,187 INFO [STDOUT] Configuring log4j from [jar:file:/usr/cdhs/adobe_livecycle_es3/tmp/adobejb_server1/ArchiveStore/5029/soapui-2.0. 2.jar!/soapui-log4j.xml] 2012-04-12 09:01:
-
Dear Friends, I got error during work wiht Sub contracting the error is " Account 89100 req an assingn to CO ojects" when receive the material from the vendor. Regards Reddy