How to make a sum of text_field or column with where condition?
Hi all
In Oracle forms 6i, I created a form in which there are 5 text_Items (with 20 none of the displayed fields) namely ACCOUNT FD DO, AMOUNT, INTEREST RATE, STATUS and INTEREST_YEAR.
FD ACCOUNT NO. | AMOUNT | INTEREST RATE | STATUS | INTEREST_YEAR |
47665 | 50000 |
| E | 5750 |
37463 | 60000 | 12 | D | 7200 |
47651 |
100000
- 12.5
D
12500
34766
70000
11
E
7700
I want to make the sum of the INTEREST_YEAR where status = 'E '.
I created a TOTAL_INTEREST_YEAR name field in which I want to display the sum.
How the sum with where condition?
Thank you.
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
Oracle form Builder 6i.
Michael,
When you write the formula for a calculated item, it does not use PL/SQL expressions (to include built-in DECODING) in Forms 6i. If there was no conditional control over your calculation, you can simply make your article a summary point and perform the summation over column interest_rate . However, because your calculation depends on the value in the STATUS column, you will need to use a combination of a calculated item and a summary article because you can't use an IF, DECODE or any other PL/SQL statement in the formula for the calculated item. Therefore, you need to create a function in the knot of program units and call the function in your formula. I tested it using the following code and it worked correctly.
First, create the following function in the node of the object browser program units.
FUNCTION calc_interest RETURN NUMBER IS n_ret_val NUMBER := 0; BEGIN IF ( :YOUR_BLOCK.STATUS = 'E' ) THEN n_ret_val := :YOUR_BLOCK.interest_rate; END IF; RETURN n_ret_val; END calc_interest;
First, you must change the property to BLOCK request all archives = Yes
Then, open the palette of your calculated item property, and set the following properties:
1. calculation = Formula
2 property Forumla = CALC_INTEREST
3. point data base = No.
Now create a second item in the table not based on in your block that will display the amount of the interests summarized. Open the palette property for this element and set the following properties:
1 Data Type = number
2 calculation Mode = Summary
3. function = sum
4 summarizes point = "name of your element calculated.
5 base of data point = No.
6 canvas = "your canvas.
When you query your block, you should see the sum of all records where STATUS = 'E '.
It worked for me, in my example form that I created so this should work for you.
Craig...
Tags: Oracle Development
Similar Questions
-
How to make the sum of the time through SQL?
Dear friends
I have a sh_detail table and there are three fields hours1, hours2 hours3. all fields are of type varchar2.
data are like
hours1 hours2 total hours3
02:45 00:18 01:25
00:38 01:45 00:00
02:15 02:00 00:15
1. I want to add on three fields in the total column
2 and want to make the sum of all areas as select sum (hours1) of sh_detail.
Please help I will be grateful.
Kind regards.
As others have said, use the NUMBER to store times, or the type of data correct INTERVAL, even if the latter cannot be aggregated (using the SUM).
In the meantime, this will give you the output desired in a few minutes (it is trivial to convert it back in format hh: mm if you wish):
SQL> with sample_data (id, hours1, hours2, hours3) as ( 2 select 1, '02:45', '00:18', '01:25' from dual union all 3 select 2, '00:38', '01:45', '00:00' from dual union all 4 select 3, '02:15', '02:00', '00:15' from dual 5 ) 6 select id 7 , sum(h1) h1 8 , sum(h2) h2 9 , sum(h3) h3 10 , sum(h1+h2+h3) as total 11 from ( 12 select id 13 , to_number(substr(hours1, 1, 2))*60 + to_number(substr(hours1, 4, 2)) as h1 14 , to_number(substr(hours2, 1, 2))*60 + to_number(substr(hours2, 4, 2)) as h2 15 , to_number(substr(hours3, 1, 2))*60 + to_number(substr(hours3, 4, 2)) as h3 16 from sample_data 17 ) 18 group by rollup(id) ; ID H1 H2 H3 TOTAL ---------- ---------- ---------- ---------- ---------- 1 165 18 85 268 2 38 105 0 143 3 135 120 15 270 338 243 100 681
-
How to make a bootable USB using the disc with El Capitan utilities?
Anyone know how to make a bootable USB key using the disc with El Capitan utilities?
Try this its worked perfectly.
-
How to make the text in the header change with scrolling effects?
Im trying to do a header which changes when you scroll the page. I know how to make the text scrolls and back according to the key position, but his does not work if my key is less than my position of text on the page.
Ideally, I would like to get so that I scroll to the area of 'Wine', the previous header will slide out and 'Wine' will slide in from the left.
Any ideas?
You can try these:
http://musewidgets.com/products/Parallax-list
http://musewidgets.com/products/three-box
Thank you
Sanjit
-
How to make the virtual machine in 64-bit with VMware6.5
My CPU: AMD Turion 64 * 2
Operating system: Windows xp 32
Question:
I want to run Open solaris 2008 which is 64 bit, I did a virtual machine but it is 32-bit. You tell me how to make the virtual machine in 64 bits in VMware6.5, I really appreciate.
Yes. Power off the virtual computer. Change the settings. Change the guest OS to Solaris 10 to Solaris 10 64-bit.
-
How to make the sum of hours which is the varchar2 data type in oracle
Hi my table is like this
emp_ngtshthrs (empno number (10), nightshifthrs varchar2 (20));
now I want sum employee nightshifthrs how do the sum hours, it's my hours 01:00, 05:00, 08:00, 10:00, 07:00 and 09:00
I want the sum type varchar2 hours how to do? and I want to display the sum is greater than 24:00Well, first of all you have posted your question in the wrong forum. You should have posted your question in the forum SQL and PL/SQL .
The second problem I see is that you are being too generic when you have your employees enter their night shift hours worked. If you are able, I recommend that you change your table to record hours separately from minutes and make columns of type NUMBER instead of the VARCHAR2() type. Then, you can simply use arithmatic to total the hours and minutes worked.
If you are locked in your table and cannot change it, you can convert characters to numbers and then perform your basic arithmatic on values. For example:
1 with tab1 as ( 2 select 10 as empno, '01:00' as nightshifthrs from dual union all 3 select 10 as empno, '05:00' as nightshifthrs from dual union all 4 select 10 as empno, '08:00' as nightshifthrs from dual union all 5 select 10 as empno, '10:00' as nightshifthrs from dual union all 6 select 10 as empno, '07:00' as nightshifthrs from dual union all 7 select 10 as empno, '09:00' as nightshifthrs from dual) 8 select sum(to_number(replace(nightshifthrs,':','.'))) AS hours_worked 9* from tab1 SQL> / HOURS_WORKED ------------ 40 SQL>
Of course, if your users can and do enter the minutes, then which complicates the example I provided. You will need to convert the decimal minute, sum the amount, then convert the decimal time and add this to your hours. For example:
1 with tab1 as ( 2 select 10 as empno, '01:15' as nightshifthrs from dual union all 3 select 10 as empno, '05:00' as nightshifthrs from dual union all 4 select 10 as empno, '08:30' as nightshifthrs from dual union all 5 select 10 as empno, '10:00' as nightshifthrs from dual union all 6 select 10 as empno, '07:45' as nightshifthrs from dual union all 7 select 10 as empno, '09:00' as nightshifthrs from dual) 8 select sum(to_number(substr(nightshifthrs,1,2))) + SUM(to_number(SUBSTR(nightshifthrs,4,5)))/60 9* from tab1 SQL> / HOURS_WORKED ------------ 41.5 SQL>
I hope this helps.
Craig...
-
How to make a sum of a subquery which first determine the time period and then the total sum.
Hello
I know how to solve it in two of the query, but I want to merge this in a single query.
I have records in a table with the status 1. I also have records in the table with the State 2 and 3. But the 2 and 3 folders can have a period different kind of these must be determined in advance when this is, mind a deviding through 3 or 12 months.
Double nesting is not allowed with Oracle, I detected. There may be more than 1 card whose status is 2 or 3 and I want to collect these and return as a sum value.
select clk.clickid ,clk.uidclickstatus ,clk.period ,clk.STARTTIME ,clk.stoptime ,clk.CREATETIME ,clk.VOLUME "Open click volume" ,sum(tot_volume) --This doesn't work and is my problem! ,(select case when ec.period = 'M' then ec.volume when ec.period = 'Q' then ec.volume / 3 when ec.period = 'Y' then ec.volume / 12 else 0 end as tot_volume from click ec where ec.uidcontract = clk.uidcontract --807430 and ec.starttime = clk.starttime --Maybe the good reader will be saying why are you deviding, this is now directly related to keep it simple for now and ec.stoptime = clk.stoptime --Maybe the good reader will be saying why are you deviding, this is now directly related to keep it simple for now and ec.uidclickstatus in (2, 3) ) sourced_volume from click clk ,lscmcontract ctr where clk.UIDCONTRACT = ctr.UIDCONTRACT and ctr.UIDCONTRACT = 807430 and clk.uidclickstatus = 1 order by clk.uidclickstatus asc, clk.period, clk.starttime ;
Can someone help me how to solve this problem?
I'm not a guru on SQL. Straight motion is not a problem but what advanced...
Thank you
Nico
OK, I've already said I'm not a guru, but I solved my problem. I didn't know that it is possible to put a sum around a case. In the end, it is the solution:
select field ,field ,(select sum(case when clk.period = 'M' and ec.period = 'M' Then (ec.volume) when clk.period = 'M' and ec.period = 'Q' Then (ec.volume / 3) when clk.period = 'M' and ec.period = 'Y' Then (ec.volume / 12) when ((clk.period = 'Q' and ec.period = 'M') or (clk.period = 'Q' and ec.period = 'Q')) Then (ec.volume) when clk.period = 'Q' and ec.period = 'Y' Then (ec.volume / 4) when clk.period = 'Y' Then ec.volume end) as Month_Vol from ec.table where ... and ... ) volume from clk.talble where ...
Nico
-
How to make the sum of numeric fields based on a value in a text field - charge memo
I'm working on a Weekly Report of expenses employee that contains a list of charges and each can be marked as a company or a paid employee costs. There are two fields in the form which is to show totals for the company and the employee paid expenses. There are seven columns for amounts, one for each day of the week. Expense Code text fields are called "Exp1" through "Exp7". Digital type amount fields are called 'Amount1' by 'Amount7. The fields under each column share the same name. (Hope that makes sense). A screenshot is below, and a link to the form is included in order to better understand the composition of the form. I don't know how to for a total of to the top of all expenditures that are marked with a 'C' and all those marked with an "E". I'm not well versed in Java. Any suggestions would be greatly appreciated! Thank you!!
Link to the form:
https://www.dropbox.com/s/sgsle5bkam2y4am/expense%20Report%20v1_0%20-%20LC%20Original.PDF? DL = 0
I tried to implement your requirement in the form at the following link. If please test and let me know if it works.
-
How to make a sum of working capital for a 12 month calendar look back?
I have a table with dates and values for each date. I would like to create a total working capital which looks backward from today and give me a total for the past 12/24 months. Is there a feature that will allow me to do this? Thank you!
Hello
You could do something like that.
Version A: = SUMIFS (B, $A, "> =" & EOMONTH(A1,0) (TODAY (), −12) will GET)
Version b: = SUMIFS (B, $A, "> =" & EOMONTH(A1,0) will GET (TODAY (), 13))
Version C: = SUMIFS (B, $A, "> =" & EOMONTH(A1,0) will GET (today (), 13) ', ')<>
A version assumes that you do not want to include values for the current month (part-time).
Version B "was one more month" so you include the current month.
Version C would be appropriate if you have future dates in your column too and must exclude those.
To come back two years you would have-24 or - 25 in formulas.
More on today, SUMIFS and EOMONTH(A1,0) will GET here, here and here.
My 39:41 lines are defined as lines of footer to make it easy to enter formulas. Formulas, of course, could be in a separate table.
SG
-
Beginner problems - how to make the sum of the lists in a drop-down table
Hello
Please forgive my newness but I'm creating a table with 10 + lines and columns and need to calculate the sum of the columns. The user must select a number from a drop-down list and I would like to summarize these nbumbers at the bottom of the column, seems simple enough...
I have named each cell in the links tab but can't seem to find the script of the sum on the right. I just started using livecycle and have had a good experience so far.
I wish it was like excel where you just need to click or highlight the cells you want to summarize and do with it but I can't seem to find the easy button...
You can not simply highlight a column, name it and then use that name in a script to sum?
Thanks a lot for all the help and I have looked around, but can't get a grip on this one, so I apologize if this is requested before.
Go easy on me.
You have to be very accurate with referencing the fields or the formulas will not work. If you have renamed the fields of their default values, then you should reference them as you named the.
Here's an example of my hierarchy, called as you explained:
In this case, the use of scripts on the Total field will look like this:
this.rawValue = (Row1.A1.rawValue * 1) + (Row2.B1.rawValue * 1) + (Row3.C1.rawValue * 1) + (Row4.D1.rawValue * 1);
So that when I switch to preview, it behaves correctly:
-
How to make the sum of the two values in the text boxes?
Hi people,
Am a beginner in oracle 9i with forms 6i forms.using. I want to add two values in two text boxes and the result should be displayed in the third text box.
How to write code in when the button is pressed the trigger of a push button? pls suggest me.
Concerning
VIDSI have not problem
Better you recreate the new formBlock3
1 button
2. item1
3 item2
4 point 3.every article must be in a canvas
what button to trigger
writing and code test it again.give point 1 only
give point 2 only
Now press the button
output should on the 3rd point.Check and return back.
Iqbal
-
How to make a SUM function on table with TI-auto
Hi all
I created a table with column 2:CREATE TABLE Suppliers
Example: I have these data in the table
(
Id NUMBER(10) PRIMARY KEY,
ProductNum NUMBER(10) NOT NULL,
Amount NUMBER(10) NOT NULL
);----------------------------------
And I want a query to get the sum of the amount of each product, that is if I run this query o the previous table, I expect the following result
Id|ProductNum|Amount|
----------------------------------
1| 4A | 50 |
----------------------------------
2| 10Q | 3 |
---------------------------------
1| 4A | 40 |
---------------------------------
3| Q9 | 32 |
---------------------------------
2| 10Q | 60 |
. . .
. . .
. . .------------------------------
Thanks in advance
ProductNum|Amount|
------------------------------
4A | 90 |
10Q | 63 |
Q9 | 32 |
. | . |
. | . |Something like this->
select ProductNum, sum(Amount) from Suppliers group by ProductNum;
Kind regards.
LOULOU.
-
Re: Qosmio F60 - how to make the volume buttons to only work with Media Player?
Hello.
I was wondering if I could make the Volume up and Volume down button keys compatible with my AIMP3 Media Player software.
I tried to press on them, only to realize the right controls the overall volume of Windows.
I tried the assignment of the keys to the keyboard shortcut list in the software. But he continued to play with the volume of Windows.No idea how to fix this to make it work with my Player volume only?
My OS is Windows 7 64 bit
Thanks in advance.
> No idea how to fix this to make it work with my Player volume only?
AFAIK you cannot fix it. These buttons are for the Windows level volume only.
But I don't see why it is so important. Set the volume level in WMP to the maximum level and simply change the level of Windows. In General, the result is the same. Or not? -
How to make a submission button work on mobile with my PDF
I don't want to use the Adobe Central forms. I have a client who wants a PDF on their mobile site to be readable and editable on an iPad. The Send button does not work. Is there a work around or any other way to do this work. I realize the PDF form can be contacted via the iPad, but not everyone or the 'clients' know the email address to send to, then how can I make this work. Any suggestions or anyone else encounter this problem? I don't want to ask my customer to ask its customers to buy software, when they should be able to just download adobe reader to fill out the form and send it as we do on an ordinary desktop computer.
Be aware that sending will not work with office (Win/Mac) Adobe Reader versions before 11 unless you also drive - enable documents. 11 reader and mobile versions are able to record the forms to which have not been activated.
-
How to make a capture of Premiere Pro CS4 with scene detect in HDV from a SONY HVR M15U deck?
News of the computer:
Windows 7 64 bit
PC ACPIx64
Xenon (R) Intel (r) CPU x 5650 @2. 67 GHz 2.67 Ghz
24.0 GB of RAM DDR3 memory
Hard drives: C drive is mirror 2 x 500 GB SATA - operating system, programs, windows VM, 387 GB free
M drive: 1 TB SATA 901 GB of video files free media player
N drive: 1 TB SATA 929 GB free trailers video & audio media player
Video card: bus NVIDIA Quadro FX 3800 4 PCI, device 0, function 0 driver 8.15.11.9038
DVD/CD Rom drive: Optiarc DVD RW AD - 7260S
IEEE 1394: Texas Instruments OHCI
Audio device high definition
Virtual memory: 24567 MB Windows chose what is best
Adobe Production Premium CS4 - first Pro 4.2.1
Other programs installed
NERO 9 Multimedia
CCleaner
CPUID
Microsoft Security Essentials
Name of the OS Microsoft Windows 7 Ultimate
Version 6.1.7600 Build 7600
Another Description of OS not available
OS manufacturer Microsoft Corporation
Name of the system SUPEREDIT
System manufacturer Supermicro
System model X8SAX
Type of system PC x 64
Processor Xeon of Intel (r) CPU X 5650 @ 2.67 GHz, MHz, 6 Lossnay 2668, 12 or logical processors
Version of the BIOS/Date American Megatrends Inc. 1. 1A, 29/04/2010
SMBIOS Version 2.6
Windows directory C:\Windows
System directory C:\Windows\system32
Boot device \Device\HarddiskVolume1
Locale United States
Layer of HAL Version = "6.1.7600.16385".
Username SuperEdit\Michel
Zone Pacific daylight time
Physical memory (RAM) installed GB 24.0
Total physical memory GB 24.0
Available physical memory 21.9 GB
Total virtual memory 48.0 GB
Available virtual memory 45.8 GB
File of the page space GB 24.0
Swap file C:\pagefile.sys
Unable to capture HDV. Unable to capture from a Sony HVR M15U or directly from a Canon XH - A1 or Canon XL - H1 via one cable 1394. Project settings: Capture HDV.
Parameters:
M video capture: video capture,
M: Audio captured audio capture,
Audio video previews N: video and an Audio excerpt
The sequence settings: reading: external device: zero, conversion of image format: audio systems Hardware, disable video output in the background, default settings for the General settings.
The remote control: the remote control DV/HDV
When I click on change capture settings: Capture format: HDV and HDV settings click the highlight of the yellow border lights, but no window opens. Why a window opens with the settings?
I can control the HVR M15U, see and hear the video playback, but when I click on the record button, the screen becomes a blue screen with the rules of the game on the video material (what?) text on the screen and no audio. I don't have the ability to detect scene. It records the audio and video in a long clip (blind faith just is the recording and I do not have something for the blind).
I have an another editing system with Windows 7 64-bit CS4 Production Premium with a Matrox RT - X 2 card. When I connect the HVR-M15U to this system, I can see and hear the recording as it is captured, with scene detect the work.
My goal is to make this new system works without a Matrox RT - X 2 card. Where can I change the settings in order to see and hear what is recorded? How can I also get the scene detection to work? I made the change of compatible host OHCI 1394 controller (legacy), but that has not changed anything.
Are there settings to see and hear the video as it is registered?
Use HDVSplit. Much better than the CS4 PR, offer scene detection, avoids errors OOS (out-of-sync), gives an extract and is free.
Maybe you are looking for
-
Mini TiVo with airport express
My question is about the tivo, the Airport express and the extreme of the AC. have the romaio standard tivo in my room and the mini in the other room about 25 feet, with thick walls about 7 feet. the mini is to cut the audio and the video of course
-
the questions and the interference of bluetooth
Hello. I am plagued by a terrible connection between my bluetooth magic mouse, keyboard and trackpad and my iMac. Mouse movements are jerky, cut off intermittently and make the impossible work to my iMac. The keyboard and the trackpad disconnect and
-
Reinstall the operating system on Satellite P200-1JR
Hello!Please help me, I need our help.How to reinstall the system pre-installed on my laptop safely? My OS: Vista Home Premium (32 bit)3 GB RAM Thanks in advance
-
Download updates on phone line ISP will take forever
My friend has an old computer with OS XP SP3 and updating Windows inform him he will take nearly 4 hours to download all updates. They are seniors and their telephone line cannot be tied up during this period. I know that the files that must be downl
-
Decommissioning of Presario SR5715 of base from Vista to XP Pro.
I managed to acquire the video drivers and the SM Bus controller, but I have difficulty finding an audio driver. Help, please. Thank you.