2 sums on the same field??
hi
I need a special request to do that:
source :
date price type
01/01/05 1000 credit
02/01/05 500 credit
02/01/05 200 debit
01/01/05 2000 debit
01/01/05 3000 debit
01/01/05 12 credit
02/01/05 12 credit
result wanted:
date credit debit
01/01/05 1012 5000
02/01/05 512 200
i can't find this request.
I need a request in SQL without function like decode of Oracle
Thx for help
create table t(d date, n number, t varchar2(40));
alter session set nls_date_format='DD.MM.RR';
insert into t values (to_date('01/01/05'),1000,'credit');
insert into t values (to_date('02/01/05'),500,'credit');
insert into t values (to_date('02/01/05'),200,'debit');
insert into t values (to_date('01/01/05'),2000,'debit');
insert into t values (to_date('01/01/05'),3000,'debit');
insert into t values (to_date('01/01/05'),12,'credit');
insert into t values (to_date('02/01/05'),12,'credit');
select d,
sum(n*instr(t,'debit')) debit,
sum(n*instr(t,'credit')) credit
from t
group by d;
D DEBIT CREDIT
01.01.05 5000 1012
02.01.05 200 512
Similar Messages
-
Using !format on multiple occurrences of the same field
I'm trying to use the @if function to apply formatting to two occurrences of a field, but am not having any luck so far. The specific example is that I have two check boxes on the template, and would like to have only one of them checked at a time, using the same field in my data file for both check boxes. The field that I'm using in my data file is:
^field ACCOUNT_TYPE
And the only two possible values for that field are CHECKING and SAVINGS. On the first ACCOUNT_TYPE checkbox, I have entered the following !format:
@(If("@_$_."=="CHECKING","X"," "))
And on the second ACCOUNT_TYPE check box it is
@(If("@_$_."=="SAVINGS","X"," "))
The @if statement works fine when I apply it to only one of the check boxes, but when I apply it to both, nothing populates into the field. A simple solution would be to change the data, but doing so is not an option in this case for me. Any help or alternate solutions is appreciated. Thanks!Hi
I treid different combination keeping the same field name for two radio buttons but it didnt work. You can work out with an alternate solution , keep different name for two radio buttons say : JF07 & JF08
And under JF07 for !Format event : @(If("@JF03."=="SAVING","S",""))
And under JF08 for !Format event : @(If("@JF03."=="CHECKING","C",""))
where JF03 is the field name which may have one of two value : i.e either SAVING or CHECKING
So your form consits of 2 radio buttons ( JF07,JF08) and one field label JF03. In your dat file you have to refer to first radio button that appears first on the form i.e left to right or top to bottom.(So whatever radio button is appearign first in the sequence on the form from left to right use that radio button in dat file.Here its JF07)
^symbolset 108
^page 1
^field JF03
CHECKING
^field JF07
==========
^symbolset 108
^page 1
^field JF03
SAVING
^field JF07
Hope this layman's altenate solution will give you a bit of relief.
thanks
jaY -
Different fonts in the same field
Is it possible to format a single field with two different fonts. I have concatenated two database columns to get this field. But I want different fonts for the two columns. I could achieve this by using a format trigger and placing some html tags. But this solution only works if the output is in HTML style sheets. It does not work if I want the output to be in PDF. Does anybody know how to achieve it in PDF? Is it possible at all (from what I have seen it isn't). I will be grateful for any help in this direction.
Thanks
JanakiHi!
Try this:
Let say you have scott/tiger and emp-table and want to concatenate and print ename and job in the same field but with different fonts.
1. In the Database model you have the columns seperate as usual.
2. Create a boileplate text field and put &ENAME &JOB in this field.
3. Select &ENAME and set the right font to it, set another font for &JOB.
4. Run and test. This should work... -
I would like to use Formcentral form data to populate a pdf with the same fields. Is that possible?
Randy,
We have an application that I would like to have in Formscentral. That application is also in a larger PDF file that once filled in populates all the other forms below it (lease, credit check form, ect). If the Application on Formscentral keep the same field names as the pdf can I pull the data from formscentral and sill populate the old application pdf so that all the forms below it will be also populated.
Greg -
Getting the name of the previous event of a field in another event of the same field?
How to get the previous event that has occured on the same field?
For example when we click a text box click event occurs then the enter event occurs.so want to know how to write a code in enter event of the text box to check that the click event has occured before the current event in java script.?
Please give an idea.
Regards,
Sugan.Any changes (like adding new fields, deleting existing field, change field properties of existing fields) applied to the database table has to adjust to changes to their definition in the ABAP Dictionary. So everytime when you make any new change on a database table, table conversion is required to refresh the exisiting entries in the ABAP dictionary so as to synchronize Database & Data Dictionary.
Thanks,
Rakhi
Edited by: Rakhi Nair on Oct 4, 2011 7:21 PM -
Providing F4 help for the same field on selection screen
Hello Experts,
My requirement is :
There are 2 radio buttons and a parameter "p_file" on my selection scree.
1. rb_appl
2. rb_pres
If the radio button rb_appl = 'X', I need to place the logic of F4 help of application server for the field p_file. Else if the rb_pres = 'X', then I need to place the logic of F4 help of presentation server for the same field p_file.
I have written the code in the below manner
PARAMETERS: rb_appl RADIOBUTTON GROUP rad DEFAULT 'X',
rb_pres RADIOBUTTON GROUP rad ,
p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
IF rb_appl = 'X'.
PERFORM f_applictn_server_filenm.
ELSEIF rb_pres = 'X'.
PERFORM f_presentation_filenm.
ENDIF.
But I am getting the F4 help for only the radio button for which i have placed the default value in the parameters.
So please let me know how to define the F4 help for the same field based on the radio buttons.Hi,
You can acheive the same by the addition of [USER-COMMAND fcode].
RADIOBUTTON GROUP group [USER-COMMAND fcode] - The addition USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.
So you code should be altered as
PARAMETERS: rb_appl RADIOBUTTON GROUP rad
USER-COMMAND radclick "Addition which you have to make.
DEFAULT 'X',
rb_pres RADIOBUTTON GROUP rad ,
p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
IF rb_appl = 'X'.
PERFORM f_applictn_server_filenm.
ELSEIF rb_pres = 'X'.
PERFORM f_presentation_filenm.
ENDIF.
Thanks & Regards,
Harish -
Freetype OR digital signature in the same field?
Hello,
I'm creating a form for someone who wants to be able to use a digital signature OR free type within the same field.
I've tried creating a new combo box with the free type as the first option, but can't seem to figure out a way to have a digital signature as the second option.
Does anyone know if it's possible to get both options in one field?
Thanks in advance.Thanks, George. You've helped me several times in the past and I know you're a power user, so if you say it's not possible, I know I'm barking up the wrong tree! Appreciate the reply.
-
Pull more than one field into the same field in a report.
I am attempting to put together a report in Visual Studio 2008. It seemed a simple report at first, but as I am creating the SQL, I am having a little trouble conceptualizing how to get it to work exactly as needed. Here is the issue...
In this case, the report should show two rows for each department. One is the count of who within an audience (that will be set up as a parameter) completed a certain course (the course may also be a parameter). The next row should be
a count, within that same department, of all users within the audience. Both counts should be within the same field on the report, but on different rows.
My thought was to create two CTE's. One would contain the counts, by department, of everybody in the audience. The other would contain the counts, by department, of those within the audience who completed the given course.
The problem is, though, I need to then have these two counts by department on two separate lines, and they should be within the same field. Basically, the idea is they are the numerator and denominator. There would also be a field before the count that would
need to identify which one it is. For the sake of the example, call it "Measure_ID" and it would say "CourseCert" for the count of who completed the course and "CourseAvail" for the count of those who are part of the audience.
Let me know if that makes sense, or if I can provide any further clarification to help you better understand what I am trying to achieve. Does anybody have thoughts on how to do this?Unfortunately, the counts need to be in separate rows. If they could be in the same row, it would have probably been a lot easier. I think I could have just done a couple "Case When" type formulas within the list of things under "Select."
As it is, I need the two counts to show up under the same heading in separate rows. Unfortunately, the table structure of this database is very complicated. I think it would likely just further confuse things if I tried to share all of that detail here.
That is why I was trying to be generic.
Unless there is another easier way I am missing, I was thinking the easiest way to achieve what I needed was to use two CTE's. One would list all users by department who belong to a specific audience (the audiences are what we use to then assign them
to certain courses, so the audience would be the people who are required to complete a certain course). The other would list all user by department who are in that audience and have completed a particular course. I think I am fine to complete that part.
It is just getting them to then display as in my example that I am not sure how to do.
The desired result, as you see in my example, has two lines per department, the first being a count of those who completed the course ("Certified"). The second line being a count of those who are required to complete it ("Available").
Does that help? I was basically hoping somebody had an example they could use, just with fake table names so I could adapt it to my data. If it helps, though, let's pretend the two CTE's are like this:
Table Name: Certified
Table's purpose: This table would list all people who had completed the course.
Fields:
CourseName
CourseCode
AudienceName
AudienceCode
CompletionResult
EmpCode
DepartmentCode
Table Name: Available
Table's purpose: This table would list all people who are assigned to the audience.
Fields:
AudienceName
AudienceCode
EmpCode
DepartmentCode
The desired result would then count the EmpCodes, by department, from each table in that Measure_Amount field so it could display as I showed above. Does that make sense? I apologize if that does not help to clarify. I was trying to be as simple
as possible so you could just use it as a generic example. -
Combobox and UseLOV with the same field
Hi,
i want use a Combobox which Select a Field name and after make a UseLov with this field name.
I can make the combobox with field name Column and i can separatly make a USELov with a field name, but i can't make it together.
Have tried two things create a new Bean with one method which call theses two methods and i have tried call the two methods directly in the JSP on the same field.
In each case the first method's call is ignored.
Thanks
Philippe
nullPhilippe,
To do this you'd have to implement your own control.
Thanks
Blaise -
How to Print the same field value in a single row
Hi,
I need to print the same field values in a single row
For Examble
in a table TestTable
ID Name Value
1 AB 120
1 BC 150
1 CD 130
2 AB 111
2 BC 112
2 CD 113
I need the query like if the Name contains BC and CD then i need to print like ID, BC Value, CD Value as below
ID BC'Value CD'Value
1 150 130
2 112 113
Kindly suggest me...
Thanks in Advance
AnuHi,
Since you're on 9i some available functionality unfortunatly isn't at your disposal.
This should work, however, using your sample data:
MHO%xe> create table t as ( -- generating sample data:
2 select 1 cid, 'AB' cname, 120 cvalue from dual union all
3 select 1, 'BC', 150 from dual union all
4 select 1, 'CD', 130 from dual union all
5 select 2, 'AB', 111 from dual union all
6 select 2, 'BC', 112 from dual union all
7 select 2, 'CD', 113 from dual
8 );
Tabel is aangemaakt.
MHO%xe> select cid
2 , max(decode(cname, 'BC', cvalue, null)) BC_value
3 , max(decode(cname, 'CD', cvalue, null)) CD_value
4 from t
5 group by cid;
CID BC_VALUE CD_VALUE
1 150 130
2 112 113For reference and future challenges, see:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:419593546543
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php -
Pulling more than one field into the same field within a report.
I posted this in the T-SQL forum, but it was suggested it may be better to post it here. This is somewhat complicated, so I hope I am explaining this well. I will post here what I posted there. I will also include two replies I gave in offering further information
in case that may help to further clarify my question. See below:
I am attempting to put together a report in Visual Studio 2008. It seemed a simple report at first, but as I am creating the SQL, I am having a little trouble conceptualizing how to get it to work exactly as needed. Here is the issue...
In this case, the report should show two rows for each department. One is the count of who within an audience (that will be set up as a parameter) completed a certain course (the course may also be a parameter). The next row should be a count, within that
same department, of all users within the audience. Both counts should be within the same field on the report, but on different rows.
My thought was to create two CTE's. One would contain the counts, by department, of everybody in the audience. The other would contain the counts, by department, of those within the audience who completed the given course.
The problem is, though, I need to then have these two counts by department on two separate lines, and they should be within the same field. Basically, the idea is they are the numerator and denominator. There would also be a field before the count that would
need to identify which one it is. For the sake of the example, call it "Measure_ID" and it would say "CourseCert" for the count of who completed the course and "CourseAvail" for the count of those who are part of the audience.
Let me know if that makes sense, or if I can provide any further clarification to help you better understand what I am trying to achieve. Does anybody have thoughts on how to do this?Unfortunately, the counts need to be in separate rows. If they could be in the same row, it would have probably been a lot easier. I think I could have just done a couple "Case When" type formulas within the list of things under "Select."
As it is, I need the two counts to show up under the same heading in separate rows. Unfortunately, the table structure of this database is very complicated. I think it would likely just further confuse things if I tried to share all of that detail here.
That is why I was trying to be generic.
Unless there is another easier way I am missing, I was thinking the easiest way to achieve what I needed was to use two CTE's. One would list all users by department who belong to a specific audience (the audiences are what we use to then assign them to
certain courses, so the audience would be the people who are required to complete a certain course). The other would list all user by department who are in that audience and have completed a particular course. I think I am fine to complete that part. It is
just getting them to then display as in my example that I am not sure how to do.
The desired result, as you see in my example, has two lines per department, the first being a count of those who completed the course ("Certified"). The second line being a count of those who are required to complete it ("Available").
Does that help? I was basically hoping somebody had an example they could use, just with fake table names so I could adapt it to my data. If it helps, though, let's pretend the two CTE's are like this:
Table Name: Certified
Table's purpose: This table would list all people who had completed the course.
Fields:
CourseName
CourseCode
AudienceName
AudienceCode
CompletionResult
EmpCode
DepartmentCode
Table Name: Available
Table's purpose: This table would list all people who are assigned to the audience.
Fields:
AudienceName
AudienceCode
EmpCode
DepartmentCode
The desired result would then count the EmpCodes, by department, from each table in that Measure_Amount field so it could display as I showed above. Does that make sense? I apologize if that does not help to clarify. I was trying to be as simple as possible
so you could just use it as a generic example. -
How to summary a field from 2 separate tables but having the same fields
Post Author: thuyvd78
CA Forum: General
Hi, I am getting trouble with creating the summary from 2 separate tables. These tables dont have any link together but they have the same fields, such as: part id, qty, etc. I need to create a report that displays whole the information from these tables and also the summary of total qty field of these tablesAny idea to organize this report? Thank you very much! ThuyPost Author: thuyvd78
CA Forum: General
Thank you for your help v361.where can I can get the link to download samples for subreport from official website?And can I use FULL INNER query to join these tables. I think this way is much clearer than using subreport but not sure it will work? Thanks Thuy -
Sales order and return sales order in the same field
Hi Everybody,
I have sales sales order and return sales order in the same field ,how can i separate these two orders in the report.
Your suggestions are appreciated
Warm Regards
ShreyaBoth are sales documents and should be separated by document type....i assume that all the documents are sotrd in the same infocube and if you have tha document type characteristic you can separated them directly in a report
Regards -
How do you sort numbers in the same field in excel 2010 the same for access 2010
Hi,
Is there a way to sort data horizontally in the same field in excel and for access, or is there an addin that can do this
or function code
field data 6-4-25-23-11-45
sort order 4-6-11-23-25-45
Regards,
Rudolf
rudolfelizabethsort data horizontally in the same field in excel
Does "in the same field" means that the string "6-4-25-23-11-45" is located in one cell?
In that case you have to use an UDF. Paste this code into a regular module:
Function SortNumbersPrim(ByVal What As String, Optional ByVal Delimiter) As Variant
Dim Arr, Temp
Dim i As Long, j As Long
Arr = Split(What, Delimiter)
For i = LBound(Arr) + 1 To UBound(Arr)
Temp = Val(Arr(i))
For j = i - 1 To LBound(Arr) Step -1
If Val(Arr(j)) <= Temp Then Exit For
Arr(j + 1) = Arr(j)
Next
Arr(j + 1) = Temp
Next
SortNumbersPrim = Join(Arr, Delimiter)
End Function
Then use a formula like this:
=SortNumbersPrim(A1,"-")
Andreas. -
Combining Multiple occurrencesof the same field value into one and Sum prob
Hi
I am trying to combine the multiple occurrences of the field values and sum the amount to the target
Source
<Record>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>5</Amount1>
<Amount2>5</Amount2>
</Item>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>15</Amount1>
<Amount2>15</Amount2>
</Item>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>5</Amount1>
<Amount2>5</Amount2>
</Item>
</Record>
Target
<Record>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>25</Amount1>
<Amount2>25</Amount2>
</Item>
</Record>
I am using MM at present. All fields are KeyFields here. Should check against each other.
I followed Context setting to the Root Item and Sort, SplitByValue and CollapseContext to achieve the functionality.
But it checks against each field and not all fields. So either one field has different value, only that perticular field gets into New Node and not the entire record. In this case, i might need UDF i guess. Any UDF help is much appreciated
Bad Target example of what i am getting
Source
<Record>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>5</Amount1>
<Amount2>5</Amount2>
</Item>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>15</Amount1>
<Amount2>15</Amount2>
</Item>
<Item>
<Item1>2</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>5</Amount1>
<Amount2>5</Amount2>
</Item>
</Record>
Target
<Record>
<Item>
<Item1>1</item1>
<item2>2</item2>
<item3>3</item3>
<item4>4</item4>
<Amount1>25</Amount1>
<Amount2>25</Amount2>
</Item>
<Item>
<Item1>2</Item1>
</Item>
</Record>
In the above scneario, only Item1 returns the value into different node. But i like to have entire node values into the record, if one value changes in the entire record.
Appreciate your help with the UDF in advance
</Record>I think you are looking for string aggregation.
The following are the replies posted by me in the forum recently on the same case.
they might help you.
Re: Concatenating multiple rows in a table - Very urgent - pls help
Re: Doubt in a query ( Urgent )
Re: How to remove words which consist of max 2 letters?
Re: output like Name1,Name2,Name3...
Maybe you are looking for
-
Store Filename in Container Operation of BPM?
Hi, Is it possible to store filename in Container Operation of BPM step? I know that using mapping and assigning that field to Container Operation can be done. But, is it possible to do without using payload field assignment? Regards, Ashish
-
Sql order in where clause...
i want to ask about how oracle deal with the order of where cluase as in select * from where tname = 'EMP' and tabtype = 'TABLE' oracle strat from down (tabtype) or from up (tname) and there is difference between this order if the where clause contai
-
Sales Order - Export help needed
Hi Gurus I am checking Export Sales Order Settings and also testing export sales order. While creating sales order I am getting one error "Material SDHD00000A4A0501 is not defined for sales org.1200, distr.chan.00, language EN" Kindly give me the de
-
How do i save an iPhoto slideshow to a disk, how do i save an iPhoto slideshow to a disk
I have created a slideshow with iPhoto and need to burn a disk of it. How do I do that?
-
External RSS feed through Omniportlet?
Just curious to know how to get an external RSS news feed to work properly through the Omniportlet in 10g. I've got the feed coming in and filtered properly, but the link that is created when the portlet displays includes the base portal url (i.e. ht