Running Total Value or Zero
Post Author: jligget
CA Forum: Formula
Good afternoon,
I have a 2 running totals that sums either debits or credits. There may be cases where there are no credits so in place of the sum I need to place zero's.
The running total has a formula in it of {@detail transaction code} in ['22', '32'] and if so it then sums the amount field. (22 or 32 desingate a credit - I have another running total for a debit)
The problem is that if no credits exist nothing gets summed and I get spaces in my running total field. How can I make it so that it will display zeros instead?
Thanks,
Jeannette
Post Author: Jeffs23
CA Forum: Formula
I had some minor issues with my formulas and Running Total so I modified them alittle:
@TotalTime
If {Data.ApptTime} = 0 then 0else {Data.ApptTime}
@Converted Time
If {#RTotal0} = 0 then "--"else ToText(Truncate({#RTotal0}/60),0,"") + " Hour(s), " + ToText(Remainder({#RTotal0},60),0,"") + " Min(s)"
My running total stayed the same.......
Field to Summarize - @TotalTime Type of Summary - sum Under Evaluate Section: "Use a Formula":(onfirstrecord or{Data.ResourceStart} <> previous({Data.ResourceStart}) or{Data.Resource} <> previous({Data.Resource}) ) andminimum({Data.ApptKind},{Data.ResourceStart}) = 1 AND maximum({Data.Column},{Data.ResourceStart}) >= '1' Reset on change of field {Data.Resource}
Some fake sample data:
Resource = Francis, William MD
Facility 1: River Oaks Main Clinic
Facility 2: Western Medical Hospital
Date of Service = 10/25/2007
From 7:15 am to 11:45 am, Patients were treated at Facility 1: River Oaks Main Clinic *** (total time = 4 hours 30 min)
From 12:15 pm to 1:00 pm, Patients were treated at Facility 2: Western Medical Hospital *** (total time = 45 min)
From 1:00 pm to 3:15 pm, Patients were treated at Facility 1: River Oaks Main Clinic *** (total time = 2 Hours 15 min)
The report should tell me Total time at River Oaks Main Clinic = 6 Hours 45 min and 45 min for Western Medical Hospital. What it currently is doing, is reporting the 6 Hours 45 min on the River Oaks Main Clinic and 7 Hours 30 min on the Western Medical Hospital. The time for this facility should be 45 minutes, yet its taking the full provider time and throwing it into this second facility. I am assuming its because the Running total tells it "Reset on change of field {Data.Resource}". Somehow, I need it to evaluate on both the Resource and the Facility. Any suggestions?
Similar Messages
-
Running total required but with different timing
Hi All:
I am using Oracle9i Enterprise Edition Release 9.2.0.6.0
I want to write a query to display the statistics report with running total.
I have written following query that return last 60 minutes activities.
SELECT se.tserv_id,
sum(decode(eu.category,'I',1,0)) Imp,
sum(decode(eu.category,'E',1,0)) Exp,
count(*) Total
FROM service_events se, equipment_uses eu
WHERE se.performed BETWEEN trunc(sysdate-60/1440,'mi')
AND trunc(sysdate,'mi')
AND se.tserv_id IN ('EXM','GROUNDED')
AND eu.gkey = se.equse_gkey
AND eu.category IN ('I','E')
GROUP BY se.tserv_id;
now I want to write a query that shows me the result of above query and running total as well
But the different between current activity and running total is as follows
Current Activity = Last 60 minutes activity
Running Total = Total activities from the 08:00 am till sysdate.
for example if this query executed on 11:00 am then the current activity values must be from 10:00 am to 11:00 am and the running total values must be from 08:00 am to 11:00 am
The reason for running total starts at 08:00 am is that the shift starts from 08:00 am to next day 07:59 am.
Can I write one single query for this?
Similarly running total values must be start from last day 08:00 am to current date and time when I executed this query from 00:00 to 08:00 (12 midnight to 8am)
if difficult then plz let me know that how can I find that if the time is from 00 hrs to 08 hrs then start time must be the last date 08:00 am to the current date and time.
Thanks
HassanDear Frnak
Thanks for your reply and help
Its really did what I want
I mean to say that the result format is correct but the value of Total_day column is not correct.
Following is the sample data from 19-Jun-2008 08:00 AM to 20-JUN-2008 08:00 AM
TSERV_ID EQUSE_GKEY PERFORMED
===============================================
EXM 5188958 19-Jun-2008 8:00:32 AM
EXM 5185586 19-Jun-2008 9:03:34 AM
EXM 5181960 19-Jun-2008 9:03:35 AM
EXM 5173333 19-Jun-2008 9:03:35 AM
EXM 5188263 19-Jun-2008 9:08:49 AM
GROUNDED 5174055 19-Jun-2008 9:10:29 AM
GROUNDED 5152887 19-Jun-2008 9:10:29 AM
GROUNDED 5187512 19-Jun-2008 9:10:29 AM
GROUNDED 5196303 19-Jun-2008 9:27:41 AM
EXM 5196370 19-Jun-2008 9:29:50 AM
EXM 5172045 19-Jun-2008 10:01:23 AM
GROUNDED 5196269 19-Jun-2008 11:11:29 AM
GROUNDED 5200219 19-Jun-2008 11:24:39 AM
GROUNDED 5185246 19-Jun-2008 12:06:30 PM
GROUNDED 5190134 19-Jun-2008 12:09:27 PM
GROUNDED 5190475 19-Jun-2008 12:09:27 PM
GROUNDED 5156065 19-Jun-2008 12:26:49 PM
GROUNDED 5132287 19-Jun-2008 1:56:44 PM
EXM 5189203 19-Jun-2008 2:29:17 PM
EXM 5180158 19-Jun-2008 3:27:03 PM
EXM 5149310 19-Jun-2008 3:37:31 PM
EXM 5196303 19-Jun-2008 3:42:48 PM
EXM 5192768 19-Jun-2008 4:03:51 PM
EXM 5174055 19-Jun-2008 4:14:23 PM
EXM 5200231 19-Jun-2008 4:45:51 PM
EXM 5157151 19-Jun-2008 4:51:06 PM
EXM 5159930 19-Jun-2008 5:01:36 PM
EXM 5185237 19-Jun-2008 5:01:37 PM
EXM 5195434 19-Jun-2008 5:01:37 PM
EXM 5152887 19-Jun-2008 5:06:49 PM
EXM 5196269 19-Jun-2008 5:06:49 PM
EXM 5187512 19-Jun-2008 5:17:26 PM
EXM 5190134 19-Jun-2008 5:59:24 PM
GROUNDED 5101919 19-Jun-2008 6:44:36 PM
GROUNDED 5101918 19-Jun-2008 6:44:37 PM
GROUNDED 5101913 19-Jun-2008 6:44:37 PM
EXM 5185735 19-Jun-2008 6:46:38 PM
GROUNDED 5195475 19-Jun-2008 6:47:11 PM
GROUNDED 5195361 19-Jun-2008 6:47:12 PM
EXM 5132608 19-Jun-2008 7:02:23 PM
GROUNDED 5195334 19-Jun-2008 7:10:32 PM
GROUNDED 5190558 19-Jun-2008 7:10:32 PM
EXM 5183029 19-Jun-2008 7:33:53 PM
EXM 5183480 19-Jun-2008 7:39:12 PM
EXM 5189566 19-Jun-2008 8:00:11 PM
EXM 5181825 19-Jun-2008 8:15:57 PM
EXM 5183537 19-Jun-2008 8:15:57 PM
EXM 5180210 19-Jun-2008 9:08:27 PM
GROUNDED 5193136 19-Jun-2008 9:58:23 PM
EXM 5171510 19-Jun-2008 10:21:59 PM
EXM 5185615 19-Jun-2008 10:48:14 PM
EXM 5184737 19-Jun-2008 10:53:29 PM
EXM 5195475 19-Jun-2008 11:51:16 PM
EXM 5195476 20-Jun-2008 12:01:46 AM
EXM 5190558 20-Jun-2008 12:12:17 AM
EXM 5196473 20-Jun-2008 12:54:19 AM
EXM 5183204 20-Jun-2008 1:20:34 AM
GROUNDED 5192844 20-Jun-2008 1:28:24 AM
GROUNDED 5174238 20-Jun-2008 1:28:24 AM
GROUNDED 5193127 20-Jun-2008 1:28:24 AM
GROUNDED 5185794 20-Jun-2008 1:29:09 AM
GROUNDED 5192895 20-Jun-2008 3:04:23 AM
GROUNDED 5193039 20-Jun-2008 3:04:23 AM
GROUNDED 5195447 20-Jun-2008 3:04:23 AM
GROUNDED 5190228 20-Jun-2008 3:04:24 AM
GROUNDED 5179370 20-Jun-2008 3:04:24 AM
GROUNDED 5190289 20-Jun-2008 3:04:24 AM
GROUNDED 5174065 20-Jun-2008 3:04:24 AM
GROUNDED 5192862 20-Jun-2008 5:04:42 AM
GROUNDED 5199903 20-Jun-2008 5:04:42 AM
EXM 5178176 20-Jun-2008 6:30:29 AM
EXM 5185161 20-Jun-2008 6:46:14 AM
EXM 5180226 20-Jun-2008 6:46:14 AM
GROUNDED 5202026 20-Jun-2008 7:03:14 AM
EXM 5101912 20-Jun-2008 7:07:14 AM
GROUNDED 5176763 20-Jun-2008 7:25:27 AM
GROUNDED 5185494 20-Jun-2008 7:25:27 AM
EXM 5185295 20-Jun-2008 7:38:46 AM
EXM 5173837 20-Jun-2008 7:49:15 AM
GKEY CATEGORY
=================
5101912 I
5101913 I
5101918 I
5101919 I
5132287 I
5132608 I
5149310 I
5152887 I
5156065 I
5157151 I
5159930 I
5171510 I
5172045 I
5173333 I
5173837 I
5174055 I
5174065 I
5174238 I
5176763 I
5178176 I
5179370 I
5180158 I
5180210 I
5180226 I
5181825 I
5181960 I
5183029 I
5183204 I
5183480 I
5183537 I
5184737 I
5185161 I
5185237 I
5185246 I
5185295 I
5185494 I
5185586 I
5185615 I
5185735 I
5185794 I
5187512 I
5188263 I
5188958 I
5189203 I
5189566 I
5190134 I
5190228 I
5190289 I
5190475 I
5190558 I
5192768 I
5192844 I
5192862 I
5192895 I
5193039 I
5193127 I
5193136 I
5195334 I
5195361 I
5195434 I
5195447 I
5195475 I
5195476 I
5196269 I
5196303 I
5196370 I
5196473 I
5199903 I
5200219 E
5200231 E
5202026 EAnd I used the same query suggested by you.
WITH s AS(
SELECT se.tserv_id , eu.category ,
CASE
WHEN se.performed BETWEEN
to_date('&target_dt','DD-MON-RRRR HH24:MI') - (1/24)
AND to_date('&target_dt','DD-MON-RRRR HH24:MI')
THEN 1
ELSE 0
END AS in_hour ,
CASE
WHEN TRUNC (se.performed - (8/24)) = TRUNC (to_date('&target_dt','DD-MON-RRRR HH24:MI')
- (8/24))
THEN 1
ELSE 0
END AS in_day
FROM service_events se , equipment_uses eu
WHERE eu.gkey = se.equse_gkey
AND eu.category IN ('I', 'E')
AND se.tserv_id in ('EXM','GROUNDED')
SELECT tserv_id,
SUM (DECODE (category, 'I', in_hour)) AS imp_hour,
SUM (DECODE (category, 'E', in_hour)) AS exp_hour,
SUM (in_hour) AS total_hour,
SUM (in_day) AS total_day
FROM s
GROUP BY tserv_idNow you have the sample data for almost 24 hours
Let me clear it again
When I executed this query at 20-JUN-2008 09:00 AM it gives me following result (that is accurate)
TSERV_ID IMP_HOUR EXP_HOUR TOTAL_HOUR TOTAL_DAY
EXM 2 0 2 3
GROUNDED 1 0 1 8When I executed this query between 20-JUN-2008 00:00 to 20-JUN-2008 08:00
then system must show the Total_Day value from 19-JUN-2008 08:00 to current date and time. e.g
I executed this query at 20-JUN-2008 06:00 AM it gives me following result:
TSERV_ID IMP_HOUR EXP_HOUR TOTAL_HOUR TOTAL_DAY
EXM 0 0 0 44
GROUNDED 2 0 2 35Now here you can see that the value of Total_Day is not as accurate as I required:
EXM = 44 and GROUNDED = 35
these values are between 19-JUN-2008 00:00 to 20-JUN-2008 06:00 (that is wrong in my case)
The values of total_day should be as follows as 8 hours from 00:00 to 07:59 AM fall in the shift of 18-JUN-2008 not in 19-JUN-2008
From 19-JUN-2008 08:00 to 20-JUN-2008 06:00
EXM: 38
GROUNDED: 32
Plz note that this result is required because in our company the shift starts from 08:00 AM and ends 07:59 AM next day
I hope you will be more clear now and there is no confusion anymore.
Plz let me know if you still confused.
Brgs, -
Runnin Total value mismatched in Sectioning
Hi Experts,
Am using 2 Dimensions(Say A&B) & Running total of one particular measure(C).
When 2 Dimesions(A&B) are in the Table level, Running total of particualr Measure(C) is showing Exact value.
But, if one of the dimension is on the Sectioning.. Running Total value changed....
Anyone, Pls, help in this problem....
Thanks in advance,
ChithraHi Chithra,
How you are expecting runningsum exactly?
if you want each section starts with new(starts from first row measure in section) runningsum, hope below formula will help you
=RunningSum([Measure];Section) OR =RunningSum([Measure];([Sectioned field]))
If you want continuous RunningSum just use below formula.
=RunningSum([Measure])
Hope above formulas will help you............... -
Costing Run If RM has zero value
Dear Friends,
My client is going to get Raw material from parent compnay on free of cost. Now that mateial has 0 price. This material is the part of production of finished good.
Now If I run cost estimate or costing run then system is giving error message "" No price could be determined for material/batch xxxxxxxx"".
How I can do this thing that free of cost raw material (has std./MAP=0) should be the part of bom and cost estimate/costing run can be run sucessfully for finished goods.
If with zero value it is not possible then how I can do , please sugget if possible by some setting in PP/CO.
Thanks
RaviDear Ravi,
Check with this steps.
1.Either set the check box for do not cost in the costing 1 view for that material in the material master.
2.If this is not working means,you can remove the costing relevancy indicator for that material in the BOM,just double click on
the item number of that particular material whose value is zero and you can find this field under the status/long text tab page.
Check and revert back.
Regards
Mangalraj.S -
DTW error 10000100 Document total value must be zero or greater than zero
I am trying to import AR service invoices and I am getting an error.
I am using the Document and Document line files and I have tried several different ways but still get the same error.
On the main document file I have
DocNum,DocType,DocDate,DocDueDate,CardCode,NumAtCard,TaxDate,Doctotal
123 S (tried the ddocuemnt_Service) 20111130 20111130 1111 TEST 20111130 1.00
Document lines
ParentKey,LineNum,ItemDescription,TaxCode,FormatCode,Location,LineTotal
123 (blank) decription EX 418000 1 1.00
Now I have tried removing the total columns on 1 file, then alternating it...leaving it on both.
What am I missing here?
ThanksHi,
You may check this first: DTW Error when Importing A/R Quotation - document total value must be zero
Thanks,
Gordon -
Sum values to display total (running total)
I apologize for posting such a rudimentary question but I haven't been able to find an answer by searching the forum.
Basically, I have several sensor inputs that are all factored into an equation that yeilds heat output (btu/hour). I need to take this value, which I have iterating once every second, and add it to itself every time it increments. In other words, say the first value is 10 (btus), the next second the value is 16, the code calculates and displays a value of 26 on the front panel and waits for the next second (or whatever iteration I choose) at which time it will add the new value to the running total.
Thanks for your input
Jake
Solved!
Go to Solution.The Loopback function (<--) is basically a miniature shift register.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV -
DTW Error when Importing A/R Quotation - document total value must be zero
Hey all,
I am facing the error document total value must be zero or greater than zero when trying to import the Sales Quotation in Item type.
This is my sample source file:
1. Document
DocNum DocType DocDate CardCode DocCurrency DocRate Series
DocNum DocType DocDate CardCode DocCur DocRate Series
1 dDocument_Items 20111015 C0003 MYR 1 11
1 dDocument_Items 20111015 C0003 MYR 1 11
1 dDocument_Items 20111015 C0003 MYR 1 11
1 dDocument_Items 20111015 C0003 MYR 1 11
1 dDocument_Items 20111015 C0003 MYR 1 11
1 dDocument_Items 20111015 C0003 MYR 1 11
2. Document Line
ParentKey LineNum ItemCode ItemDescription Quantity Price
DocNum LineNum ItemCode Dscription Quantity Price
1 0 A0001 from legacy Record 1 24.00
1 1 A0002 from legacy Record 1 12.00
1 2 A0003 from legacy Record 1 2.50
1 3 A0004 from legacy Record 1 9.90
1 4 A0005 from legacy Record 1 2.00
1 5 A0006 from legacy Record 1 1.50
Kindly look for your advises.
Thank you.
Regards,
Wai LengHi Wai Leng Tan,
Enter Data as per following details
Document Header level
DocNum DocType DocDate CardCode DocCurrency DocRate DocTotal Series
DocNum DocType DocDate CardCode DocCur DocRate DocTotal Series
248 dDocument_Items 20111221 C42000 INR 1 100 11
Document Line level
ParentKey LineNum ItemCode ItemDescription Quantity Price
DocNum LineNum ItemCode Dscription Quantity Price
248 0 I00007 HP Printer 95 Inkjet Cartridge 1 100
Not Enter Document Total ZERO
Thanks,
Srujal Patel -
Use running total to get cumulative value
Just want to clarify, can it be get the cumulative value of string instead of numeric figure by using running total function?
for example:
Date Action
01/Jun Created
02/Jun Deleted
03/Jun Created
11/Jul Deleted
12/Jul Created
13/Jul Deleted
Can it be counted as a number of action & cumulate for each month?
ideal result is:
June
Created:2 Deleted :1
July
Created:3 Deleted :3
Thank for share...This can be done using Running Totals. I'm assuming you are grouping your results by month.
1. Create a running total for the "Created" action called RunningTotalCreated:
Field to summarize: {Table.Action}
Evaluate: Use formula:
{Sheet1_.Action} = "Created"
Reset: on change of group "Month".
2. Create a running total for the "Deleted" action called RunningTotalDeleted:
Field to summarize: {Table.Action}
Evaluate: Use formula:
{Sheet1_.Action} = "Deleted"
Reset: on change of group "Month".
3. Create a formula called result with the following code, and drag it into your month group footer.
"Created: "+totext({#RunningTotalCreated},0)+" Deleted: "+totext({#RunningTotalDeleted},0)
Cheers,
Fritz -
Item Transaction History Report - Calculation for creating 'Running Total'
Hello
Using Oracle Discoverer, we have written a report that pulls back all Inventory Transactions (by item number). This report lists both transactions IN (e.g. receipts into the store) and OUT (e.g. issues out from the store).
Our customer would like an additional column, to represent 'Running Total', to be added to the report. This column needs to capture the running 'On Hand Quantity' for the associated Item, as each transaction (both transactions IN and OUT of store) is displayed.
For example, if the initial/first transaction for an item was a Receipt of 500, then this column (on the first line) should display 500. If the second transaction for the item was an issue of 15, then this column (on the second line) should display 485. If the third transaction was for an issue of 50, then this column (on the third line) should display 435. If the fourth transaction was for a receipt of 20, then this column (on the fourth line) should display 455 etc etc
I'm not sure how I'd write a calculation to cater for this (within discoverer) - do you know if this is achievable? Any help would be much appreciated. This would be easy enough to do in Excel, but I'm a bit of a novice when it comes to discoverer(!)
Many thanks
RossHi,
You can generally do this type of calculation using analytic functions. You would partition by the item number and order by the transaction date in the analytic function. You can use SUM function (with an order by) to get a running total of a column in the report. You can SUM a calculation containing a CASE statement which changes the OUT transactions to a negative number. The SUM function will start at zero, so you then can use FIRST_VALUE function to get the first value for the item which you could then add to the totals.
Rod West -
Running Total & Distinct Count Query
Crystal 10.0.0.533 CR Professional
Hope you can assist.
I have a report listing deals signed, each deal has a corresponding category i.e. industry type, Accountant, Chiropractor, Financial Services, etc.
I am undertaking a Distinct Count on these categories so that in the group footer it is showing number of different categories signed in a period (the report is grouped into different date periods). This is working OK.
However, I need to EXCLUDE the category from this distinct count if the deal value is zero.
I have tried using a formula to show a blank field if the value is zero, however it appears to be distinctly counting the blank as a category?
Any assistance would be much appreciated.
TracyDeffinetly it will be less than what you expect for grand total. It is because when you are calculating distinct count for each group suppose
Group A has categories A,B,C,D-->distinct count (4)
Group B has C,D,E,F-->distinct count (4)
but while calculating grand total then the distinct count will be
A,B,C,D,E,F --> grand total (6) but not (8).
In this case you need to use mannual running total like this
whileprintingrecords;
numbervar i;
i:=i+{running total};
place this in group footer and create another fomula like this
whileprintingrecords;
numbervar i;
place this in report footer to get the correct grand total.
Regards,
Raghavendra -
Running Total Variation Query Time Optimization
Hi all,
I've been struggling with this query for a while. I need to set a customer specific running total for 10 million rows (reset for every customer). But every time the number goes negative, I need to set it as zero.
For example,
member no amount wallet
member1 400 400
member1 -500 0
member1 200 200
member2 700 700
member2 -200 500
Query:
DECLARE @member float
DECLARE @prev_member float
DECLARE @amount float
DECLARE @wallet float
DECLARE db_cursor CURSOR FOR
SELECT [Member no], [Transaction Amount]
FROM [wallet_master_3]
ORDER BY [Member No], [rownum]
FOR UPDATE
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @member, @amount
SET @prev_member = @member
set @wallet=0
WHILE @@FETCH_STATUS = 0
BEGIN
IF @prev_member <> @member set @wallet=0
SET @wallet = @wallet + @amount
IF @wallet < 0 SET @wallet = 0
UPDATE [wallet_master_3] SET walletsize = @wallet
WHERE CURRENT OF db_cursor
set @prev_member=@member
FETCH NEXT FROM db_cursor INTO @member, @amount
END
CLOSE db_cursor
DEALLOCATE db_cursor
I've tried using a cursor. In five minutes, it ran 17,000 rows but after running it for 15 hours, the code only manages to set the running total for 175,000 rows. I'm not exactly sure why. Is there a faster approach I can use?
Thanks!As an exercise a 'Quirky Update' may help you in this scenario. Try the below trick!
DECLARE @Wallet AS TABLE
MemberNo VARCHAR(10),
RowNum INT,
Amount INT,
Wallet INT
INSERT INTO @Wallet (MemberNo, RowNum, Amount) VALUES
('member1',1, 400),
('member1',2, -500),
('member1',3, 200),
('member2',1, 700),
('member2',2, -200)
DECLARE @RunTotal AS INT
UPDATE W1
SET
@RunTotal = W1.Wallet =
CASE
WHEN W1.RowNum = 1 THEN W1.Amount
WHEN @RunTotal + COALESCE(W1.Amount, W2.Amount) < 0 THEN 0
ELSE @RunTotal + COALESCE(W1.Amount, W2.Amount)
END
FROM @Wallet W1
LEFT OUTER JOIN @Wallet W2
ON W1.MemberNo = W2.MemberNo AND W2.RowNum = W1.RowNum - 1;
SELECT * FROM @Wallet;
RESULT
MemberNo RowNum Amount Wallet
member1 1 400 400
member1 2 -500 0
member1 3 200 200
member2 1 700 700
member2 2 -200 500
You can read more on 'Quirky Update' in below articles
Solving the Running Total and Ordinal Rank Problems - Jeff Moden
Robyn Page's SQL Server Cursor Workbench
NOTE: Please test it thoroughly before using in a production environment!
Krishnakumar S -
Running totals in crystal designer
Hi all!
I want to create a report with running total, that accumulate Balance value for each page.
Total accumulate should be reseted on each new page.
I have a query for report: SELECT CardCode, CardName, Balance FROM OCRD.
And i want a running total for field "Balance" (this total should be reseted on each new page).
In Crystal Designer I create new Running Total Field (in the PageFooter section).
In the Editing Running Total window I fill the following sections:
1) Summary section. Field to summarize: "Command.balance". Type of summary: "sum".
2) Evaluate section. On change of field: "command.cardcode"
3) Reset section. I want to choose PageNumber in the field "on change of field". But there is no any special field in the section "Available tables and fields"
How to reset the running total on each new page?
Thanks in advanceHi all!
The problem can be solved with report formulas. Probably this information will be useful to somebody.
So, we have the following task: need to calculate subtotals on each page.
Let's look at the solution.
On the first step, create Formula fields:
1) InitPageSum field has formula:
WhilePrintingRecords; NumberVar PageSum := 0;
2) CalcPageSum field has formula:
WhilePrintingRecords;
numberVar PageSum := PageSum + {Command.LineTotal}; // I use command to get field-values from //database
numberVar PageSum
3) PageBalance field has the following formula:
WhilePrintingRecords; numberVar PageSum
On the second step we place formula-fields in report sections.
1) Variables initialization.
Insert section in PageHeader area (lets name this section PHa). Drag formula InitPageSum into PHa for zeroing PageSum for each page. Then suppress the section PHa.
2) Increasing subtotal on page.
Create additional section in Details area (Dc). Drag CalcPageSum formula-field on this section (Dc). PageSum variable will be increasing in each line. Suppress the section Dc.
3) Display results.
a) Insert additional section in PageFooter area (let's name it PFa). Drag PageBalance formula-field into this section (PFa). The section PFa should be displayed on each page of the report, except the last page. The formula is:
if PageNumber <> TotalPageCount then true else false.
b) Insert additional section in ReportFooter area (let's name it RFa) and make this section the first section of the Report Footer area. Drag PageBalance formula-field into the section RFa. The section RFa should be displayed on the last page only. So, for the Suppress property of this section, create the formula:
if PageNumber = TotalPageCount then true else false
We make this adjustment (additional section in report footer area) because we need subtotals directly under the report (and not at the bottom of the page)
Best regards,
Katrine -
Hi,
Is there a way in QLD can have a running total like the Crystal Report capabilities? Is this possible in the Repetative Area1.
Example :
DocTotal Drawsum Result
500000 200000 300000
300000 100000 200000
200000 200000 0
The purpose of this is for Cash Advance Monitoring from AP Downpayment Invoice.
Is this possible by running difference / Balance ?
Thank you very much.
Regards,
clintHi Suda,
this is the data for you to refer :
CREATE TABLE (
INT,
DATETIME,
NVARCHAR(100),
NUMERIC(15,2),
NUMERIC(15,2),
INT,
NUMERIC(15,2),
NUMERIC(15,2),
NUMERIC(15,2),
NUMERIC(15,2)
GO
/* Data for the `Query_Result` table (Records 1 - 8) */
INSERT INTO (, , , , , , , , , )
VALUES (1575, '20080110', N'SAADA PASIGAN', N'0', N'165308.83', 135, N'165308.83', N'500000', N'334691.17', N'334691.17')
GO
INSERT INTO (, , , , , , , , , )
VALUES (1592, '20080111', N'SAADA PASIGAN', N'0', N'79563.6', 135, N'79563.6', N'500000', N'420436.4', N'420436.4')
GO
INSERT INTO (, , , , , , , , , )
VALUES (1599, '20080111', N'SAADA PASIGAN', N'0', N'53102.95', 135, N'53102.95', N'500000', N'446897.05', N'446897.05')
GO
INSERT INTO (, , , , , , , , , )
VALUES (1604, '20080111', N'SAADA PASIGAN', N'0', N'38415.6', 135, N'38415.6', N'500000', N'461584.4', N'461584.4')
GO
It compute for the difference of the DocTotal1 and Drawsum, that is correct but I want to have a running diffrence betwenn MIN(Drawsum) only.
Example from the above data :
The total Cash Advance is 500000 only. The Drawsum will deduct the 500000 until it become zero. Refer Below :
Doctotal DrawSum The Remaining Total of 500000
500000 165308.83 334691.17
the remaining amt shall be carry on which is the 334691.17 and not the 500000.
DocTotal DrawSum The Remaining Total of 500000
334691.17 79563.6 255127.57
255127.57 53102.95 202024.62
202024.62 38415.6 163609.2
and so onn...
Hope that you got me.
Thank you.
Clint -
Running Total not working correctly
I have a running total setup inside a for loop, the problem is that the running total isn't "running" . Below is the syntax
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,3,1)?>
<?xdoxslt:set_variable($_XDOCTX,’DUPE’, xdoxslt:get_variable($_XDOCTX, ‘DUPE’ ) +1) ?>
<?for-each-group@section:/ TMP008/LIST_G_ORDER_BY/G_ORDER_BY/LIST_G_INVOICE/G_INVOICE;G_INVOICE?>
TABLE HERE+_
<?end for-each?><?end for-each?>
I am using this loop to print 3 copies of an invoice, then by using the running total I am trying to call a unique footer on each copy by having the following code in the footer.
<?choose:?>
<?when: xdoxslt:get_variable($_XDOCTX,’DUPE’)=”1”?>
<?call:Footer1?>
<?end when?>
<?when: xdoxslt:get_variable($_XDOCTX,’DUPE’)=”2”?>
<?call:Footer2?>
<?end when?>
<?otherwise:?>
<?call:Footer3?>
<?end otherwise?>
<?end choose?>
What is happening is the first copy is using Footer 3 and the other 2 copies are using Footer 1. FYI at the top of the rtf I have a import statement and set_variable statement as shown below:
<?import:file:///C:\Documents and Settings\username\Desktop\MasterFooter.rtf?>
<?xdoxslt:set_variable($_XDOCTX,’DUPE’, 0)?>
The variable DUPE is getting the value 1 on every page which I don't quite understand.
Any help would be greatly appreciated. I can attach the xml file and rtf if so desired. ThanksFirst initialise a variable and assign it value zero (with this code..)
<?xdoxslt:set_variable($_XDOCTX, 'RunTotVar', 0)?>
then embed the following code within the for loop where you want the running total displayed..
the code below shows a running total for the xml field INVOICE_AMT
<?xdoxslt:set_variable($_XDOCTX, 'RunTotVar', xdoxslt:get_variable($_XDOCTX, 'RunTotVar') + INVOICE_AMT)?><?xdoxslt:get_variable($_XDOCTX, 'RunTotVar')?>
Hope this helps. its from one of the examples provided with the template builder for word.
-Domnic -
Running Total for "cleared balance"
I want to produce query that will produce two running totals. The 1st once is straight forward and is 'Ledger Balance' - that is the balance after a particular transaction has taken place on that day. The Cleared Balance is the running total balance accounting for the value date of a transaction. For example a transaction for today, say $50 may be value dated tomorrow and hence is included in the Ledger Balance but would not appear in the Cleared balance until tomorrow.
Lets try and use some simple data:
TransactionsTable
Tran_ID TranDate ValueDate Amount
1 01/02/2004 01/02/2004 50
2 01/02/2004 01/02/2004 25
3 01/02/2004 05/02/2004 30
4 01/02/2004 01/02/2004 55
5 02/02/2004 04/02/2004 11
6 02/02/2004 02/02/2004 23
7 02/02/2004 02/02/2004 33
8 02/02/2004 02/02/2004 47
9 04/02/2004 04/02/2004 10
10 07/02/2004 07/02/2004 5
StatementHistory
AC_No Start_Date End_Date Opening_Ledger Opening_Cleared
55 02/02/2004 02/02/2004 160 130
55 04/03/2004 04/02/2004 274 233
Assuming that the account opened on the 01/02/04 with a zero balance.
So for a daily statement on the 01/02/04, I'd expect to see the following Details
TranDate ValueDate Amount Ledger Balance Cleared Balance
01/02/2004 01/02/2004 50 50 50
01/02/2004 01/02/2004 25 75 75
01/02/2004 05/02/2004 30 105 75
01/02/2004 01/02/2004 55 160 130
So for a daily statement on the 02/02/04, I'd expect to see the following Details
TranDate ValueDate Amount Ledger Balance Cleared Balance
02/02/2004 04/02/2004 11 171 130
02/02/2004 02/02/2004 23 194 153
02/02/2004 02/02/2004 33 227 186
02/02/2004 02/02/2004 47 274 233
And skipping to the 04/02/04, I'd expect to see.
04/02/2004 04/02/2004 10 284 254
I can get the ledger balance using:
sum(amount_to_account) OVER (PARTITION BY ac_no , trans_ID
ORDER BY TranDate, trans_ID
RANGE UNBOUNDED PRECEDING)
+ sh.Opening_Ledger
But I'm unsure how to get the Cleared balance as this need to access transaction inforation from a number of days previous (possibly up to 5 days allowing for maximum period for clearing a transaction).
Does anyone have an idea how to achive this?Hi,
Try this:
WITH A AS
select 1 col1, 'A' col2, 2 col3 from dual union all
select 1 col1, 'A' col2, 2 col3 from dual union all
select 1 col1, 'A' col2, 2 col3 from dual union all
select 1 col1, 'B' col2, 3 col3 from dual union all
select 1 col1, 'B' col2, 3 col3 from dual union all
select 1 col1, 'C' col2, 5 col3 from dual union all
select 1 col1, 'D' col2, 2 col3 from dual union all
select 1 col1, 'D' col2, 2 col3 from dual
,B AS
SELECT
A.*
,ROW_NUMBER() OVER (PARTITION BY COL1, COL2 ORDER BY 1) RN
FROM
A
SELECT
B.*
,SUM(CASE WHEN RN = 1 THEN COL3 ELSE 0 END) OVER ( ORDER BY COL1, COL2 ,RN ) cumulative_tot
FROM
B
COL1 COL2 COL3 RN CUMULATIVE_TOT
1 A 2 1 2
1 A 2 2 2
1 A 2 3 2
1 B 3 1 5
1 B 3 2 5
1 C 5 1 10
1 D 2 1 12
1 D 2 2 12
8 rows selected Regards,
Peter
Maybe you are looking for
-
Physical Filename Issue ( got past this ) and New Invalid Guideline Issue
I had a problem ( from before ) getting a file called --> test_oracle.edi into the system. I am using a set up of EDI X12 over Generic Exchange together with FILE 1.0 protocol. The file has a sender of ACME and a receiver of GLOBALCHIPS, which to be
-
Adding a checkbox in S_ALR_87012257
hi, my user wants add a checkbox field in S_ALR_87012257, 10-year actual / actual comparison.. under time series.. this checkbox field is used to diplay zero balances in the account as well.. is this the job for an ABAPer or Functional? how is it to
-
High School jobs dealing with Java
Hey guys, this is my first post on here, I figure if you need help with something go straight for the source :] So I'm in high school and just finished our Java classes, and I've been looking to get certified. (I've looked at some practice exams and
-
I am printing from lightroom on an Epson Stylus Pro R2880 on my PC. Overall, my colors have been fine. Not perfect, but good enough for what I'm doing. But, I have noticed that my skin tones are coming out extremely red/pink. 1) How do I fix this? 2)
-
Applicationundertest.launch unable to open my downloads folder path
Hi, I wanted to run a automation script in c# to open downloads folder (C:\Users\test\Downloads) and run vs_ultimate.exe file. I am using ApplicationUnderTest.Launch(@"C:\Users\test\Downloads"); under TestInitialize() but giving me error Microsoft.Vi