Query group in cfformgroup
Hi,
I can't figure out hvor to group output from a query like you
can in the cfoutput tag with the group option.
<cfscript>
q1 = queryNew("id,firstname,lastname");
queryAddRow(q1);
querySetCell(q1, "id", "1");
querySetCell(q1, "firstname", "Rob");
querySetCell(q1, "lastname", "Smith");
queryAddRow(q1);
querySetCell(q1, "id", "2");
querySetCell(q1, "firstname", "John");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "3");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Erik");
querySetCell(q1, "lastname", "Pramenter");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Jiggy");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Bush");
</cfscript>
From the above I would like to populate a tabnavigator using
the id and each page populated with firstname and lastname
inputfields.
Can anyone please help?
Hi ScareCrow,
I just made a slight modification to your code by moving the
cfoutput inside the inner most cfformgroup like this;
<cfform format="flash">
<cfformgroup type="tabnavigator">
<cfoutput query="q1" group="id">
<cfformgroup id="tab_#q1.currentrow#" type="page"
label="Tab #q1.currentrow#">
<cfoutput>
<cfinput type="text" name="firstname_#q1.currentrow#"
value="#q1.firstname#">
<cfinput type="text" name="lastname_#q1.currentrow#"
value="#q1.lastname#">
</cfoutput>
</cfformgroup>
</cfoutput>
</cfformgroup>
</cfform>
and it works like charm, thank you!
I did fiddle around with a cfoutput inside the form before I
had to give up and post my question here. After your post I
realized that the name of my query "q1" was probably the reason I
couldn't get my output loop to work, as "q1" and "ql" looks very
similar. Lesson learned, I have now changed my query name to "qq".
/Rune
Similar Messages
-
Multi-query group above report creates more pages
Hi,
I have a multi-query group above report (paper only), the parent group creates 5 rows(subframes) all onto the same page, but then creates 4 more IDENTICAL pages!!?
at the end I have 5 repating frames and 5 pages.
If I set Maximum Records per Page to 1, I have 5 pages (IDENTICAL) with the first frame only...
any idea?
cheers
Matteohello,
you will have to create a counter, that tells you the numbers of students (summary-column, function : count, reset on : course) and create a format-trigger on the heading that hides it when the number of students is 0.
regards,
the oracle reports team --pw -
Query Group in Query Category different with Authorization's group number
Hi All,
In Authorization screen, it allowed to authorize up to 20 query group
Whereas in Query Category window, it has only max 15 query group.
Anyone has idea on why is the difference?
Thanks in advance,
MHYou have a very good point. I believe something must be for system to use during development. You may post a development request to see if the next version could have matched numbers of query groups. The forum is on this link:
/community [original link is broken]
Thanks,
Gordon
Edited by: Paulo Calado on Jun 19, 2009 3:33 PM -
Query Group and Authorization group is different
Hi,
In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
Thanks.
Regards,
MHHi,
In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
Thanks.
Regards,
MH -
Linking Query group to an SAP role
I am able to link the Query group to the role but when we test the user does not have access to it. I know this used to be a problems years ago that I thought was fixes. Any ideas on how to get this to work?
Hi,
Assign the required user groups to the user in Sq03. if user still getting same error even after assignments in Sq03, ask user to please change query areas as below and check.
Sq01 --> Environment --> Query areas --> select "Stanard area (client-specific).
Regards,
Gowrinadh -
Configure custom query group in navigation menu
How do we configure custom query groups? Say for example: I have created a custom query group and added my custom query definitions to it. How do I configure this so that when I click on Contract Management Tab on the workbench, my custom query group is invoked?
I need to configure custom query group in navigation menu. Any help would be appreciated.
Regards,
Bindu SharmaHi Bindu,
As per my understanding, it is standard and query group cannot be added in the navigation but you can add your quries under Agreement and Claus Library.
Kindly refer the blog for the same: http://scn.sap.com/docs/DOC-55733
Let me know if you need any other information.
Thanks,
Kushagra A -
Saved query groups authorization
Dear All,
Saved query groups - no.1 to no. 20 are available in the authorizations form.
I see there are only 15 groups in the query manager --> manage categories, and in the authorizations are 20. the remnants are 5. Where will the five groups to be used and be able to find ?
I use SBO 2004A. I also see that it is happened in SBO 2005A. I have tried to find in SAP notes but I can't see.
I appreciate your answers. TIA
Rgds,Hi Steve,
Seems that noone here on SDN knows the answer (including myself)
I suggest that you raise that to SAP Support - to have them checking the case.
Sorry,
Frank -
Easiest way to know the query group name?
Hello All,
This has been nagging at me for quite some time now. Would appreciate you inputs on the ways to find out the query group name for a set of queries we see on the UI.
The obvious method is to search your query group from the list of query groups that system shows when we navigate to Setup->Queries and Reports->Query Groups. Do we have some other ways as well.
Thanks In Advance
DeveshHi Devesh,
If you know the query definition then the easiest way to find the query group would be to use "Search Query Groups by Queries Used" query on the Query Groups list page. This query allows you to select a query definition and returns the query group using the query.
Or you could use "Query Group Review" query on the Query Groups list page. This returns all queries within all Query Groups. You can further refine your search by Query Name or Internal Name of the query you are interested in.
If you want to do a general search for all buy-side list page or buy-side picker page query groups, search for <buylist> and <buypick> respectively.
Hope this helps.
Regards,
Vikram -
Reg: Query group by problem
Hi,
I am trying to write query for report generation.According to my client requirment I need to calculate the difference
between two date columns for "n" number of rows and i need to find the number of rows which are smaller
than 2 and number of rows which are greater than 2 and calculate the percentage for number of rows which are smaller than 2.
It must grouped by a third column
I tried like this, but it shows that date column is not a grouped .....
But I dont want to group that date column... Plz adivce....
SELECT table1.column2,
table2.column3,
COUNT(*),
CASE
WHEN TO_NUMBER (table1.DTT_column3 - table1.DTT_column4) <=2
THEN COUNT(*)
ELSE NULL
END
AS sucess_count,
CASE
WHEN TO_NUMBER (table1.DTT_column3 - table1.DTT_column4) >2
THEN COUNT(*)
ELSE NULL
END
AS fail_count,
FROM
table1,
table2
WHERE table1.column1 = table2.column2
AND table1.column4 = value1
GROUP BY table1.column2,table2.column3;TIA,
Message was edited by: ORCL
ORCLDBMay be something like this.
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for HPUX: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
1 with t
2 as
3 (select 1 id, to_date('01.02.2008','dd.mm.yyyy') date_1,
4 to_date('03.02.2008','dd.mm.yyyy') date_2 from dual union all
5 select 1, to_date('03.02.2008','dd.mm.yyyy'),
6 to_date('04.02.2008','dd.mm.yyyy') from dual union all
7 select 2, to_date('05.02.2008','dd.mm.yyyy'),
8 to_date('06.02.2008','dd.mm.yyyy') from dual union all
9 select 2, to_date('01.02.2008','dd.mm.yyyy'),
10 to_date('05.02.2008','dd.mm.yyyy') from dual
11 )
12 select count(case when to_number(date_2 - date_1) <= 2 then 1 end) diff_2,
13 count(case when to_number(date_2 - date_1) > 2 then 1 end) diff_Greater_2,
14 1 - ( count(case when to_number(date_2 - date_1) > 2 then 1 end)
15 / count(case when to_number(date_2 - date_1) <= 2 then 1 end)
16 ) percent
17 from t
18 group by rollup(id)
19* having grouping_id(id) = 1
SQL> /
DIFF_2 DIFF_GREATER_2 PERCENT
3 1 .666666667It will be always useful if you could post your full oracle version and a sample test data.
Regards
Raj -
I have a table that looks like the above. I need to be able to update values in a database based on an ioID (the invoice number)
The value I need to add is the hours times the uSalary, however as you will notice above the hours can and well have been added on an ongoing basis. For example:
smarotti has added 4.5 (0.5 + 4.0) hours for the ioID 14190 (last 2 rows) for a total cost of $143.55
So what I need is to have the value $143.55 update the record 14190 (ioID) on a new column (userCost)
So:
the userID - ddevries did 1 hour worth of work at the rate of $23.20 that needs to be update on the record 8026
the userID - kmurtha did 20 (.5 + .25 + 6.5 + .25 + 6.5 + 6) hours worth of work $696 (20 * 34.80) that needs to be update on the record 9462
make sense? anyone have any thoughts on how to go about doing this?
Thanks
VernOkay
assuming you add the column to your table the query would look like the below:
UPDATE workers
INNER JOIN (SELECT
round(SUM(hours*uSalary),1) AS cost,
ioID,
userid
FROM
workers
GROUP BY ioID, userid ) b
ON workers.ioID = b.ioID
SET workers.userCost=b.cost
WHERE workers.ioid = b.ioID
AND workers.userID = b.userID
Or if you would just like to query the data:
SELECT round(SUM(hours*uSalary),1) AS usercost,ioID,userid
FROM workers
GROUP BY ioID, userid -
Hi,
Kindly view the query.
select loan_id,status_date from loan_status_history group by loan_id,status_date
How to select the records with latest(max) status_date in each group?
regards
Mathewyou use aggregation function on one of the selected column and group by others.
in your example,
select load_id, max(status_date) from loan_status_history group by load_id -
SQL Query, group by or self join?
Hi All,
I have a table with about 100,000 rows.. It is a linking table. I want to filter out some of the data. At the bottom I will put a sample table. I am really after advice if I should be using the group by, or something else. It is really slow, and I really wanted to make a view from the query, but it won't run in realtime (I thought about Materialised views, but the data could change and I would want it updated)
So the data would like like this.
1 1
A 1
B 1
1 A
1 B
2 null/0
And I want to transform it into a result that looks like this.
A 1
B 1
2 0
(I can live with 1 1 as well)
The first query I have come up with is
select
A.TXN, A.ID SCHED_INFO, A.STA ORIG_ACT
from
SELECT
Txn, ID,
STA
FROM TEST_STA
WHERE TXN < 0
) A,
select ID, count(STA)
FROM test_STA
WHERE TXN < 0
group by ID
HAVING count(STA) > 1
) B
where A.ID = B.ID
OR A.STA = '0'
The second I came up with was.
select B.Id , A.id STA
from test_STA A, test_STA B
where A.STA = '0'
AND B.STA != '0'
AND B.STA = A.ID
AND b.TXN < 0
Where the data looks like
create table test_STA
( TXN NUMBER,
ID VARCHAR2(20),
STA VARCHAR2(20) )
insert into test_STA Values (1, '1', '0')
insert into test_STA Values (-1, '1', '1')
insert into test_STA Values (-1, '1', 'A')
insert into test_STA Values (-1, '1', 'B')
insert into test_STA Values (-1, 'A', '1')
insert into test_STA Values (-1, 'B', '1')
insert into test_STA Values (-1, '2', '0')
TXN is the transaction number -1 is current, others (> 0 are old)
What does all this mean..
Well
1 is a parent, with A and B as children.
2 is a parent with no children.
So what I want to do return is Parents with no children, and children but not their parents..
So which path should I continue my efforts down do you think ? The first one, with the group by, or the second one, with the join to it's self.
PaulHi,
If you can guarantee, that every child has also a record then following query returns your result:
select ID, count(*)
from test_STA
group by ID
having count(*) = 1
ID COUNT(*)
2 1
A 1
B 1 -
Using a SQL Query Group by is needed
Hi All,
Scenario Below:
we have 2 Transactions, 5 Lines and each line is having 2 Taxes correspondingly. We have few more formula columns which are calculating based on requirements.
We need to Group the amount at Line level for the one specific TAX.
say: L1 1, L2 2, L3 3, L4 4, L5 5. for one tax having L1, L2 and L3 which needs to be sum up 6
and for other tax needs to sum up to 9.
But, we need to display all the Lines.
Regards,
Reddy.Hi, Reddy,
Use the analytic SUM function instead of the aggregate function if you don't want to get only one line of output per group.
Since I don't have a copy of your table, I'll use the scott.emp table to illustrate.
The following query gets some information about individual employees, along with the total salary of all the employees with the same job:
SELECT job
, ename
, sal
, SUM (sal) OVER (PARTITION BY job) AS total_sal
FROM scott.emp
ORDER BY job
;Output:
JOB ENAME SAL TOTAL_SAL
ANALYST SCOTT 3000 6000
ANALYST FORD 3000 6000
CLERK MILLER 1300 4150
CLERK JAMES 950 4150
CLERK SMITH 800 4150
CLERK ADAMS 1100 4150
MANAGER BLAKE 2850 8275
MANAGER JONES 2975 8275
MANAGER CLARK 2450 8275
PRESIDENT KING 5000 5000
SALESMAN TURNER 1500 5600
SALESMAN MARTIN 1250 5600
SALESMAN WARD 1250 5600
SALESMAN ALLEN 1600 5600Almost all of the aggregate functions (including SUM, AVG, COUNT, MIN, even user-defined aggregate functions like STRAGG) have analytic counterparts. The keyword OVER after the argument list marks the function as analytic.
The analytic PARTITION BY clause corresponds to the aggregate GROUP BY.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
It never hurts to say what version of Oracle you're using. -
I have a query that returns data displayed in table that
looks like this :
Name ID Company count
Joe Smith xx1xx Burger Inc 1
Joe Smith xx1xx McDonalds 5
Bob Jones AA2AA Jets Inc 4
What I would like it to look like is this, display the name
and ID only once :
Name ID Company count
Joe Smith xx1xx Burger Inc. 1
McDonalds 5
Bob Jones AA22A Jets Inc 4
This is the code that I am attempting to use, but it
obviously is incorrect.
<cfoutput query="qryGet_Null" group="buyer_number">
<tr>
<cfoutput>
<td>#buyer_name#</td>
<td>#buyer_number#</td>
</cfoutput>
<td>#supplier_name#</td>
<td align="center">#total_count#</td>
</tr>
</cfoutput>
Where do I have to place the cfoutput tags to make the output
displayed like the sample above ?
Also, if I export to excel, will it export just the way it
is, with one name only, per supplier ?
ThanksActually, trojnfn's nesting of <cfoutput> was just
fine, since the outer <cfoutput> tag was using the group=""
attribute.
When using the group attribute, you have to remember that
everything inside the outer <Cfoutput> block will only loop
once per instance of the grouped field. the code inside the inner
<cfoutput> block will loop once for each record in your
query.
However, this may not be the best tool to use in this
situation, since it looks like you want multiple rows, but only
display the name on the first row for a given buyer. Maybe
something like this might work better for you:
<!--- Used to store the current buyer name --->
<cfset sHoldName = "">
<cfoutput query="qryGet_Null">
<tr>
<!--- Only display the buyer name if the buyer name has
changed since the last record --->
<td><cfif buyer_name neq
sHoldName>#buyer_name#<cfelse> </cfif></td>
<!--- Only display the buyer number if the buyer name has
changed since the last record --->
<td><cfif buyer_name neq
sHoldName>#buyer_number#<cfelse> </cfif></td>
<!--- List supplier name and total_count for all rows
--->
<td>#supplier_name#</td>
<td align="center">#total_count#</td>
<tr>
<!--- Store the buyer name for comparison against the next
record --->
<cfset sHoldName = buyer_name>
<cfoutput> -
Content query grouping field that use taxonomyfield display
We have a term store in two languages (Es an En) and a variation system active
I have a library that has a Managed Metadata field add
When I add a content query in a spanish page that display the library content, and group the results using this taxony field, it shows me the group in english (metadata in english but I have them in both languages).
What can I do?Have you tried using the Excel web part
Display Excel content in an Excel Web Access Web Part
Maybe you are looking for
-
Automating a link and Updating pages in Acrobat
I've a report created in Microsoft Access and exported as a PDF file. I've also created several links in the PDF document to make it user friendly. There are 5 pages that are updated on a daily basis (Exported from Access and appended to the existing
-
Reuse_alv_grid and excel
i read many threads about alv and excel specially about the trouble with excel with the line missaligned but didn't see a solution. i have the same trouble i have an alv_grd with 30 col. but when i export to excel only the first 27 are aligned the la
-
after i get my viewobject and use getwhereclause to set the parameters my records are rendered normally but i can't navigate through my records because the navigation-bar isn't working properly
-
Project Pro 2013 VBA proc is lost
Hi, I created a VBA procedure in a Project 2013 file. I created also a button in a custom tab to run the procedure. I tested everything : OK I want to demo my project : the proc has gone. I just have the button, without the VBA code. :-( What did I m
-
I can't open any application after updating to 4.3.5
i can't open any application after updating to 4.3.5???!! can someone help..? before this i coudn't listen to music with my intern speaker.