Convert query results to a list
Have a query which returns 20 records or so. I need to
convert the results to a list and then search through the list to
populate checkboxes. Simple query which returns 20 records:
<CFQUERY NAME="GetTest" datasource="test">
SELECT * FROM data
WHERE brid = '012345'
</CFQUERY>
How can I convert these results to a list so I can use
listfind?
<CFSET foo = ValueList(getTest.bar)> converts the
database field bar to the comma-delimited list foo.
Similar Messages
-
Converting Query results into HTML email
Hi,
I am using oracle 11g. I' m using the following procedure to send out html emails from a static query in the procedure and it works fine. I wanted to make it dynamic and pass the sql query as a parameter to procedure and build the html tags based on the query. Any thoughts?
CREATE OR REPLACE PROCEDURE html_sql_results
is
v_rows clob;
v_header clob;
cursor v_cursor is
select SR_NO,STATE,DUE_DT,PROCESS_DT,STATUS,DAY_NO,SEQ_NO
from T_TABLE;
BEGIN
v_header := '<table border=1>
<tr style=''background:#8DB3E2''>
<td><p><b>SR_NO</b></p></td>
<td><p><b>STATE</b></p></td>
<td><p><b>DUE_DT</b></p></td>
<td><p><b>PROCESS_DT</b></p></td>
<td><p><b>STATUS</b></p></td>
<td><p><b>DAY_NO</b></p></td>
<td><p><b>SEQ_NO</b></p></td>
</tr>';
v_rows := Null;
FOR i in v_cursor
LOOP
v_rows := v_rows ||
'<tr>
<td> <p>' || I.SR_NO||'</p></td>
<td> <p>' || I.STATE||'</p></td>
<td> <p>' || I.DUE_DT ||'</p></td>
<td> <p>' || I.PROCESS_DT ||'</p></td>
<td> <p>' || I.STATUS||'</p></td>
<td> <p>' || I.DAY_NO ||'</p></td>
<td> <p>' || I.SEQ_NO||'</p></td>
</tr> ';
END LOOP;
if v_rows is not null then
v_rows:= v_header ||v_rows ||' </table> ' ;
dbms_output.put_line(v_rows);
email_results(v_rows);
end if ;
end ;
/A possible way :
SQL> var result clob
SQL> DECLARE
2
3 ctx dbms_xmlgen.ctxHandle;
4 qry varchar2(2000) := 'SELECT * FROM hr.employees WHERE department_id = :1';
5
6 xsl xmltype := xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7 <xsl:output method="html"/>
8 <xsl:template match="/ROWSET">
9 <table border="1">
10 <tr style="background:#8DB3E2">
11 <xsl:for-each select="ROW[1]/*">
12 <td><p><b><xsl:value-of select="name()"/></b></p></td>
13 </xsl:for-each>
14 <xsl:apply-templates/>
15 </tr>
16 </table>
17 </xsl:template>
18 <xsl:template match="ROW">
19 <tr><xsl:apply-templates/></tr>
20 </xsl:template>
21 <xsl:template match="ROW/*">
22 <td><p><b><xsl:value-of select="."/></b></p></td>
23 </xsl:template>
24 </xsl:stylesheet>');
25
26 res clob;
27
28 BEGIN
29
30 ctx := dbms_xmlgen.newContext(qry);
31 dbms_xmlgen.setBindValue(ctx, '1', 90);
32 dbms_xmlgen.setNullHandling(ctx, dbms_xmlgen.EMPTY_TAG);
33 dbms_xmlgen.setXSLT(ctx, xsl);
34
35 :result := dbms_xmlgen.getXML(ctx);
36 dbms_xmlgen.closeContext(ctx);
37
38 --dbms_output.put_line(res);
39
40 END;
41 /
PL/SQL procedure successfully completed.
SQL> print result
RESULT
<table border="1"><tr style="background:#8DB3E2"><td><p><b>EMPLOYEE_ID</b></p></
td><td><p><b>FIRST_NAME</b></p></td><td><p><b>LAST_NAME</b></p></td><td><p><b>EM
AIL</b></p></td><td><p><b>PHONE_NUMBER</b></p></td><td><p><b>HIRE_DATE</b></p></
td><td><p><b>JOB_ID</b></p></td><td><p><b>SALARY</b></p></td><td><p><b>COMMISSIO
N_PCT</b></p></td><td><p><b>MANAGER_ID</b></p></td><td><p><b>DEPARTMENT_ID</b></
p></td><tr><td><p><b>100</b></p></td><td><p><b>Steven</b></p></td><td><p><b>King
</b></p></td><td><p><b>SKING</b></p></td><td><p><b>515.123.4567</b></p></td><td>
<p><b>17/06/03</b></p></td><td><p><b>AD_PRES</b></p></td><td><p><b>24000</b></p>
</td><td><p><b></b></p></td><td><p><b></b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>101</b></p></td><td><p><b>Neena</b></p></td><td><p><b>Kochhar</b></p></td><td><p><b>NKOCHHAR</b></p></td><td><p><b>515.123.4568</b></p></td><td><
p><b>21/09/05</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></t
d><td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>102</b></p></td><td><p><b>Lex</b></p></td><td><p><b>De Haan</b></p></td><td><p><b>LDEHAAN</b></p></td><td><p><b>515.123.4569</b></p></td><td><p><
b>13/01/01</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></td><
td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr></
tr></table>Typically, XSLT stylesheets may be stored in the database too, so that you can modify and use different presentation templates without touching the code. -
Managing a query result through several web pages
Hi,
I wonder what's the best way to manage a query result through several web
pages in the following context.
The query result is large and needs to be available through several web
pages. The user can scroll forward and backward through the pages.
One can :
- rerun the query at each web request and use random access
- run the query once for the first request, keep the pm and the query
somewhere (in a singleton class for example with a key in the HTTP
session) and use random access for handling the other requests (the
problems I see are to keep a connection for each user in this use case and
to decide when to close the previously mentioned objects)
- rerun the query at each web request, including in the filter a test on a
field and an ordering to start the results from the last one displayed
(being able to specify the maximum number of rows desired would be nice).
Thanks for any advice or suggestion.
Regards.I think Frank's suggestion is probably the best tradeoff between memory
consumption (which would be high if you were to store the enire query
result in the session) and performance (which might be hurt if you
re-issue the query every time).
Note that Kodo 3.0 will provide a getObjectsById(Object[] ids) method
that should help in quickly instantiating a page of query results.
Query result limiting is currently under discussion for inclusion in the
JDO specification. We may have something for this in an upcoming Kodo
release (although not for 3.0).
In article <[email protected]>, Frank Riley wrote:
[email protected] (Patrice) wrote in
news:[email protected]:
Hi,
I wonder what's the best way to manage a query result through several
web pages in the following context.
The query result is large and needs to be available through several
web pages. The user can scroll forward and backward through the pages.
One can :
- rerun the query at each web request and use random access
- run the query once for the first request, keep the pm and the query
somewhere (in a singleton class for example with a key in the HTTP
session) and use random access for handling the other requests (the
problems I see are to keep a connection for each user in this use case
and to decide when to close the previously mentioned objects)
- rerun the query at each web request, including in the filter a test
on a field and an ordering to start the results from the last one
displayed (being able to specify the maximum number of rows desired
would be nice).For our paging code, we convert the query result to a list of object ids
(using pm.getObjectId()). We store this list on the session and only
instantiate the objects we need for a particular page (using
pm.getObjectById()). When a user does something that could possibly
change the query result, we rerun the query and replace the list on the
sesssion.--
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Returning query results in XML format
Besides using custom tag library, does anyone know any methods or techniques that i can retrive the query results from database in XML format. for example, i have a table named student in database like this:
StudentNo Name Gender Degree
123 Tony male B.Comp.Sci.
456 Tom male B.Fiance
343 Mary female B.Accountingso, if i have query select * from table student, i would get someting like the following:
<row>
<studentNo>123</studentNo>
<name>Tony</name>
<Gender>male</Gender>
<Degree>B.Comp.Sci</Degree>
</row>
<row>
<studentNo>456</studentNo>
<name>Tom</name>
<Gender>male</Gender>
<Degree>B.Finace</Degree>
</row>
The reason i am asking for this is i need query results returned in XML format, so i can wrap XSLT tag around, and apply for HTML, WML, and XHTML template resprectively so i can display them on different terminals. any help is appreciated.I have this method in a ResultSetMapper class:
* Return result sets as an XML stream, with root tag named
* "results", one "result" tag per row, and "result" child tag
* names equal to the column name
* @param query result set
* @param list of column names to include in the result map
* @throws SQLException if the query fails
* @throws JDOMException if the XML stream creation fails
public static final Document toJDOM(ResultSet rs, List wantedColumnNames)
throws SQLException, JDOMException
Element rows = new Element("results");
int numWantedColumns = wantedColumnNames.size();
while (rs.next())
Element row = new Element("result");
for (int i = 0; i < numWantedColumns; ++i)
String columnName = (String)wantedColumnNames.get(i);
Object value = rs.getObject(columnName);
row.addContent(new Element(columnName).setText(value.toString()));
rows.addContent(row);
return new Document(rows);
}It uses JDOM from www.jdom.org. - MOD -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
Dear all expert,
I make an UDF and put query to that UDF. I want to make list of value of that query result is always appear when user click that UDF.
It's working fine if, the result of query is 2 rows (the list of value is pop up) but if the result only 1 row, the list of value is not show up.
The purpose to make this UDF and query is to give information to user. So, I need, the list is to show uptry this
SELECT T2.DocTotal as 'SPK Value', T0.DocNum 'Payment No', T0.DocDate 'Payment Date', T1.U_Progress, Sum(T1.U_Prog_Val) 'Progress Value', Sum(T1.U_Ret_Val) 'Retensi Value', T0.DpmAmnt 'Down Payment', T0.DocTotal 'Paid', T0.Comments
FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OPOR T2 ON T2.DocNum = T1.BaseRef
WHERE T0.U_SPK = $[$U_SPK.number] and T0.CEECFlag = 'n'
GROUP BY T2.DocTotal, T0.DocNum, T0.DocDate, T0.Comments, T0.DpmAmnt, T0.DocTotal, T1.U_Progress
Union All
SELECT 0,0, 0, '0', 0, 0, 0, 0, '0'
Edited by: Suraj V on Jul 24, 2009 1:16 PM -
Is it possible to list out CATALOG ITEMS GROUP in a Query Result of a Request Offering??
Hi Experts,
Is it possible to list out CATALOG ITEMS GROUP as a result of Query Result in Request Offering ?? Because each and every Catalog Items Groups are being created as a SingleTon Child Class of System.CatalogItemGroup. i.e., Each CatalogItemGroup instance
will have its own singleton class.
Is it possible to list out all CatalogItemGroup Instances consolidatedly in the QueryResult Window??
Though the System.CatalogItemGroup class is an Abstract class, I tried to list out the Classinstances via powershell command as below, which lists all catalog group instances, Note: Actually these are instances of SingleTon
Child Classes
"Get-SCClassInstance -Class (Get-SCClass -Name System.CatalogItemGroup)"
But when I configured the QueryResult window with the "System.CatalogItemGroup" class, it doesn't list out any Group instances in the Porta.......
Am I missing anything, Any suggestions please???
Thanks and Regards, Narayana BabuThanks Anton, I already tried that too... But it doesn't list out any Group instances in the Portal.
Since each Catalog Groups are individual Single ton Class instances derived from "System.CatalogItemGroup" class. Therfore If I specify the internal ID of the abstract class "System.CatalogItemGroup" in the tag below, it doesn't list any in the
Portal.... But if I specify ID of any one of the derived singleton class, it does displays the one instance of that particular class..
Thanks and Regards, Narayana Babu -
Query result list sort order in the Service Manager Portal (2012).
Hi there,
I have a setup a user prompt for a request offering in which the values are based on a query results list. When the user prompt is displayed in the portal the order of the items presented based on my query results list is in reverse
alphabetical order (Z to A) instead of traditional A to Z. I can clicked the column header to toggle the sort order, however having to do this is slightly annoying.
My query results list is based on returning the Department field of a specific criteria of template AD user accounts (which are imported into the CMDB via the AD Connector).
Where and how is the sort order defined?
Thanks
BryanHi Bryan,
After a quick test I can see the query results is in a descending order based on the first display column of the query results configuration. In the Request offering wizard I don't see an option for sorting. I don't think it is possible to configure this
out of the box.
But maybe it is possible from a Self Service Portal rendering point of view. Maybe there is a key for it in the settings.xml just like the maximum of query results:
http://blogs.technet.com/b/servicemanager/archive/2011/11/08/advanced-query-results-customization-for-request-offerings.aspx
If this is possible I'm also curious to know how! :)
- Dennis -
Howto handle persistence API query result list
Hello.
I need some advice on how to handle a persistence API query result List since the Object variable returned by the "list.get(i)" method cannot be cast to an EntityClass declared by the EntityClassManager.
The piece of code below might help you understand my exact problem.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("SporTakipPU");
EntityManager em = (EntityManager) emf.createEntityManager();
Query q1 = em.createQuery( "SELECT d.id, d.date, c.name, c.sirname FROM Log d, Kisi c WHERE d.id = :id AND c.id = :id" );
q1.setParameter( "id", argument );
List logList = q1.getResultList();
Log log = (Log) logList.get(1);
In this code i cannot cast Object to Log in the last line. Apparently this has something to do with the query.
Trying to solve this problem i declared two private string variables name and sirname and their set and get methods but this didn't help.
Thanks...Entity Class : ReportView
===================
@Entity
@Table(name = "dummy")
public class ReportView implements Serializable {
@Id
@Column(name = "id", nullable = false)
private Integer id;
// getter , setter
SessionBean : ReportSessionBean
==========================
public List<ReportView> getReports() {
Query q = em.createNativeQuery("SELECT ID FROM REPORT", ReportView.class);
List<ReportView> r=(List<ReportView>)q.getResultList();
return r;
JSF / Back Bean : ReportBackBean
==========================
public class ReportBackBean {
@EJB
private ReportSessionRemote reportSessionBean;
/** Creates a new instance of ReportBackBean */
public ReportBackBean() {
public List<ReportView> getReports() {
return reportSessionBean.getReports();
JSF
===
<f:view>
<h:dataTable value="#{ReportBackBean.reports}" var="report" border="1">
<h:column>
<h:outputText value="#{report.id}"/>
</h:column>
</h:dataTable>
</f:view>
Regards,
Telman
.. -
Need help on retrieving query result - NPE
Hi, I could get results with the native query in my TOAD, but I can't get it working in my session EJB. I tried both native query and EJB ql. The query created fine, as soon as I try to retrieve results, it gets stuck.
My native query looks like this:
Query query = em.createNativeQuery("select sum(o.amount_reimbursed) from t_expenses o where o.employee_id = '999999911' " +
"and o.EXPENSE_ID in (select p.expense_id from T_Per_Diem_Xref p where p.expense_Type_Xref_Id=22 " +
"and p.expense_Id in (select e.expense_Id from T_Expenses e where e.employee_Id='999999911' " +
"and e.expense_date > to_date('01/01/2011', 'mm/dd/yyyy') and e.expense_date < to_date('12/31/2011', 'mm/dd/yyyy')))") ;
My EJB query looks like this:
Query query = em.createQuery("select sum(o.amountReimbursed) from TExpenses o where o.employeeId = ?1 " +
"and o.expenseId in (select p.expenseId from TPerDiemXref p where p.expenseTypeXrefId=?2 " +
"and p.expenseId in (select e.expenseId from TExpenses e where e.employeeId=?1 and e.expenseDate>=?3 and e.expenseDate<=?4))");
query.setParameter(1, employeeId);
query.setParameter(2, expenseType);
query.setParameter(3, fDay, TemporalType.TIMESTAMP);
query.setParameter(4, lDay, TemporalType.TIMESTAMP);
Either one, I get NPE at the line retrieve result.
// sumAmt = (Double)query.getSingleResult();
List list = query.getResultList();
if (list != null) {
long longAmt = (Long)list.get(0);
sumAmt = (Double)list.get(0);
As you can see, I tried to getSingleResult, or getResultList. also tried to convert the result to Double or Long. None worked.
Please help and thank you for your time.
SophiaFrank, thank you for your reply. I have this code in my session Facade EJB, and I get the NPE in my backing bean which calls this method. When I debug the code, it appears what really cuases the problem is in this code on the line I try to assign the query result to my variable 'sumAmt = (Double)query.getSingleResult();'. In the debug, when it reaches this line, it starts to give me all kinds of pop-up windows saying couldn't find this file or that file or packages. If I get a stack trace later, I will post it. Right now I am trying to fix something else.
Thanks, Sophia -
Warning Message in query result as 'Notification Number DBMAN 345'
Hi ,
I have a warning message while executing the query
'Diagnosis
Currently, it cannot be guaranteed that SIDs and master data exists for all characteristic attributes for the DataStore object to be read.
There is a restriction on a navigation attribute of the listed characteristic in the query. This filters all characteristic values of the master-data bearing characteristic for which there is not yet master data out of the result.
For performance reasons, this filtering is unavoidable.
System Response
Procedure
In case of doubt, find other restirctions directly on the characteristic values of the characteristics contained in the DataStore object.
Procedure for System Administration
Notification Number DBMAN 345 '
'i am getting this error because of cutomer exit variables on navigatioanl attributes of Omaterial'
I tried supressing it in RSRT.. but unable to find the message.
I tried debugging and assigning enhancement points in FM BAL_LOG_MSG_READ.. As it is standard function module its not suggestable to do..
can we creat custom FM ?? will it be called if we write code to supress warning message??
Please let me know how to use BADI'S in order to supress the error message that appearing in query result?
Thanks All.Hi,
The warning is raised due to the following reasons:
- you have a selection in the filter of a navigation attribute
- in your DSO you do not use the option "SIDs Generation upon Activation"
If the option "SIDs Generation upon Activation" is not flagged,
you may get char.values for an Infoobject in the system not
having any SIDs. As a result you may see in the report less data as
expected.
For example we have Infoobject A with its Nav.attribute B
Infoobject A Nav.attribute B
12 13 ->> has a SID in the X-table
11 10
9 13 ->> has no SID in the X-table
If you define a selection on B =13 in the query, you only get infoobject
A with key 12 displayed in the result, since only B =13 has a SID
in the relevant X-table.
The warning refers to this behaviour and cannot be avoided unless you:
- flag the option in the ODS-settings
- or remove the filter defined on 0MATERIAL__xxxx
Thanks,
Venkat -
How to get Query Results based on Analysis Authorization Ranges????
Hi Experts,
I have gone through the lot of SDN Links, however not able to find the answer to my question.
I have an Authorization Issue, NO Authorization
Error : EYE 007 ( Insufficient Authorizations )
<b>Here is the issue:</b>
Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
<b>Its really urgent, please help..!</b>
Here are the logs:
Authorization Check Log
Date and Execution Time (Local Server)
Execution Date: 06.09.2007
Execution Time: 14:48:41
Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
Executed by User ZBI_TEST_001
Executed with Analysis Authorizations of Another User ZBI_TEST_001
InfoProvider Check
Building the Buffer...
...Buffer Built
Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
InfoProvider Check
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:
0CO_AREA
0TCAACTVT
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider :
List Is Empty:
There Are No Characteristics That Have to Be Checked in Detail
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
CO_AREA = '0003'
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Authorized
Subselection (SUBNR) Is Authorized
Authorization Check Complete
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Partially or Fully Authorized (Intersection) Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Value selection partially authorized. Check of remainder at end
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Not Authorized
All Authorizations Tested
Message EYE007: You do not have sufficient authorization
No Sufficient Authorization for This Subselection (SUBNR)
Following CHANMIDs Are Affected:
184 ( 0CO_AREA )
Authorization Check CompleteHi,
Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
Hope it helps,
Cheers,
Balaji -
Query to find the list of users having access to a particular scenario
Hi,
I am learning Hyperion Planning 9.2 x version. I wanted to know the query to find the list of users having access to Plan Iteration - 1 scenarion.
As I am new to Hyperion Essbase and Hyperion Planning, I am assuming these ideas work out to get the desired result.
1) As Hyperion Planning uses Relational DB to store the User Security information, we can query the list of users who is having access to Plan Iteration - 1 Scenario.
I am not sure if this solution works. Please correct me If I am wrong.
2) We can also query from the essbase editor to find out who all having access to this scenario.
If the above is correct, can you please provide me the query.
I am really need of this and I will be happy if any one provide the solution.
Thanks & Regards,
Upendra. BesthaHi,
If you are looking for some SQL to retrieve the access rights by member then you can use something like (SQL Server code though can easily be modified for Oracle)
SELECT usr.object_name as Username,mem.object_name as Member,
'Access Rights' = CASE acc.access_mode
WHEN -1 THEN 'None'
WHEN 1 THEN 'Read'
WHEN 2 THEN 'Write'
WHEN 3 THEN 'Write'
ELSE 'Unknown' END,
'Relation' = CASE acc.flags
WHEN 0 THEN 'Member'
WHEN 5 THEN 'Children'
WHEN 6 THEN 'Children (inclusive)'
WHEN 8 THEN 'Descendants'
WHEN 9 THEN 'Descendants (inclusive)'
ELSE 'Unknown' END
FROM
hsp_access_control acc, hsp_object mem, hsp_object usr
WHERE acc.object_id = mem.object_id
AND acc.user_id = usr.object_id
AND mem.object_name = 'Plan Iteration - 1'
Cheers
John
http://john-goodwin.blogspot.com/ -
Stepping through a query result set, replacing one string with another.
I want to write a function that replaces the occurance of a string with another different string. I need it to be a CF fuction that is callable from another CF function. I want to "hand" this function an SQL statement (a string) like this: (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help. I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
Here is the string I want to pass to the function:
SELECT
[VERYLONGTABLENAME].FIRST_NAME,
[VERYLONGTABLENAME].LAST_NAME,
[VERYLONGTABLENAME].ADDRESSS
FROM
LONGTABLENAME [VERYLONGTABLENAME]
Here is the contents of the ABRV table:
TBL_NM, ABRV <!--- Header row--->
VERYLONGTABLENAME, VLTN
SOMEWHATLONGTALBENAME, SLTN
MYTABLENAME, MTN
ATABLENAME, ATN
The function will return the original string, but with the abreviations in place of the long table names, example:
SELECT
VLTN.FIRST_NAME,
VLTN.LAST_NAME,
VLTN.ADDRESSS
FROM
LONGTABLENAME VLTN
Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced. The LONGTABLENAME immediately following the FROM is left as is.
Now, here is my dum amatuer attempt at writing said function: Please look at the comment lines for where I need help.
<cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
<cfargument name="txt" type="string" required="true" />
<cfset var qAbrvs=""> <!--- variable to hold the query results --->
<cfset var output_str="#txt#"> <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter. Is this necessary or can I just use the txt parameter? --->
<cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
</cfquery>
<!--- I'm assuming that at this point the query has run and there are records in the result set --->
<cfloop index="idx_str" list="#qAbrvs#"> <!--- Is this correct? I think not. --->
<cfset output_str = Replace(output_str, "#idx_str#", ) <!--- Is this correct? I think not. --->
</cfloop> <!--- What am I looping on? What is the index? How do I do the string replacement? --->
<!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
I need to know how to write this part in CF9
while not Eof do
begin
s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
Next;
end;
--->
<cfreturn output_txt>
</cffunction>
I'm mainly struggling with syntax here. I know what I want to happen, I know how to make it happen in another programming language, just not CF9. Thanks for any help you can provide.RedOctober57 wrote:...
Thanks for any help you can provide.
One:
<cfset var output_str="#txt#"> <!--- I'm creating a local
variable so I can manipulate the data handed in by the TXT parameter.
Is this necessary or can I just use the txt parameter? --->
No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope. Thus the better practice would be to reference "arguments.txt" where you need to.
Two:
I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language. Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
Three:
<cfloop index="idx_str" list="#qAbrvs#"> <!--- Is this correct? I think not. --->
I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
<cfloop query="qAbrvs">
Four:
<cfset output_str = Replace(output_str, "#idx_str#", ) <!--- Is this correct? I think not. --->
Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
<cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
Five:
</cfloop> <!--- What am I looping on? What is the index? How do I do the string replacement? --->
If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string. -
How to use query-result as a new query-fiter
HI, All
Is it possible to execute sub-query filtererd by the pre-query-reslted lists ?
As far as I investigated, only way to do is that I combine two suject-areas by using set operations like "Union" or around.
But in this way, there is an impractical restriction to define these datatype and column in common. (namely, "Union" conditions)
I just want to query filtered by ex-query-results at anytime; for example, I extract a customer lists by one query and use various analysis in the group of customer list.
Please give me some advise.
RegardsFirst create a Request with your FilterQuerey. Secund Create a Request und create a Filter. Under Advanced you will find the path to the first Requst. Than you can select the columns.
Thats it :-)
Stefan
Maybe you are looking for
-
Key Figure Aggregate in Bex Query
Hi Gurus I am using BI7.0; but 3.5x BEx tools I am loading 6 fields from a flat file. I am loading data for tickets. I have create an InfoObject that counts the number of tickets. No problem. Also I also have key figures that I am assigning the s
-
How to print JTextArea??
I am trying to print JTextArea which has more than one page of text. When there is more than one page of text in JTextArea, it only prints what is there on first page eventhough it print multiple pages. Here is the code I am using. Let me know if you
-
Is there a thumbnail view in Pages like in Adobe Acrobat?
I imported a label making template and there is some funky formatting that has created a second page that I can't seem to delete. I am trying to view the document in the "thumbnail view" a la Adobe Acrobat so I can just "see" the page in the sidebar
-
Document looks different on different computers
I am working on an ai document with a colleague but while it looks good on his computer, when I open it on my computer (from the same location on the server), it looks very grainy. When I print it it also looks fine, though. We have no idea why this
-
System time stuck after returning from deep sleep
Hi, When I return from deep sleep, my system time is set to when I entered deep sleep. Only after opening Date & Time system preferences, the time is corrected. Any help is highly appreciated. Markus