Compare Previous Row in Same Group Color Cell?
Is is possible to display multiple row/groups and compare each top and bottom row/cell within the same group and color the bottom row/cell on content mismatch?
[header title]
Row 1a cell 15
Row 1b cell 15 //compare to 1a
Row 2a cell 15
Row 2b cell 15. //compare to 2a
Hi pointeman,
According to your description, when compare the row and the previous row in the same group, you want to color the later cell if the values are mismatch. After testing the issue in my local environment, we can click the detail cell to open the Property Windows,
then use the following expression to control the BackgroundColor property:
=iif(Fields!A.Value=previous(Fields!A.Value) and Fields!B.Value=Previous(Fields!B.Value),"Red","White")
Note that the field A stands for the group field, the field B stands for the field that you want to compare.
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support
Similar Messages
-
Compare previous row values for the same id and decide
Hello ,
I have this sample data
create table #student_academic
pk_id int identity(1,1) primary key ,
student_id int ,
[year] int,
[aggr_marks] float
insert into #student_academic
student_id ,
[year] ,
[aggr_marks]
values
(112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
(112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
(112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
select * from #student_academic
from the above data i have to generate an extra status column. this status column should be decided by comparing the previous row value. the exact output should be like below.
student_id year aggr_marks Staus----------------------------------------------------------
112 2012 55.4 None
112 2013 75.4 Promoted
112 2014 61.2 Demoted
113 2012 95.2 None
113 2013 75.6 Demoted
113 2014 91.22 Promoted
113 2012 45.45 None
113 2013 65.4 Promoted
113 2014 82.32 Promoted
is there any way to write the t-sql with out using cursors ? this table has around 25GB of data. Any idea would be appreciated.
Thanks in advance.Hello,
The difficulty of your example is
that there are several rows for
the same year and the same student.
I present a solution
if there is
one line per year per
student:
TRUNCATE TABLE #student_academicinsert into #student_academic
student_id ,
[year] ,
[aggr_marks]
values
(112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
(112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
(112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
Go
WITH CTE AS
(SELECT pk_id, student_id, year, aggr_marks,
(SELECT TOP 1 aggr_marks FROM #student_academic AS b
WHERE a.student_id = b.student_id AND a.year -1 = b.year
ORDER BY student_id) AS prev_aggr_marks
FROM #student_academic AS a
SELECT
pk_id, student_id, year, aggr_marks,
CASE
WHEN prev_aggr_marks IS NULL THEN 'None'
WHEN aggr_marks < prev_aggr_marks THEN 'Demoted'
WHEN aggr_marks >= prev_aggr_marks THEN 'Promoted'
END AS Status
FROM CTE
ORDER BY student_id, year
Regards,
Charlie
Charlie Dancoisne - Independent Consultant & Trainer (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!) -
Compare two rows in same table
Hi,
I want to compare two rows (some columns) in the same table, and if the data in the data columns is different, I want to pick the latest one. The table is date tracked. For instance I have an address table with different addresses for an employee with effective date. I want to be able to pick the latest row if the postal code is different for the 2 rows. Is this possible in sql. I can do this in Pl/sql, but dont want to use it. Eg
address_id, postal_code, person_id,last_update_date
123, pn123,1,12-JAN-01
124,pu124,1,13-JAN-01
I want to be able to retrieve just the second line.
Any help is appreciatedWelcome to the forum!
Whenever you post please provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
The table is date tracked. For instance I have an address table with different addresses for an employee with effective date. I want to be able to pick the latest row if the postal code is different for the 2 rows.
>
Your question is a little confusing because you are using terms like 'date tracked' and 'effective date' without explaining exactly what your definitions of those terms is.
Why do you want the latest record ONLY if the postal code is different? What if the address is different? Then which record do you want?
Why not just take the record for each person/company that has the latest date? If the data is the same then it doesn't which record you get so the one with the latest date will do. And if the data is different taking the one with the latest date gives you the latest data.
The classic definition of effective date is 'the date the information becomes effective'. Information with a given effective date is NOT in effect before that date and is SUPERCEDED when data is entered with a later effective date if the actual date is later than or equal to the effective date. Using your data
>
123, pn123,1,12-JAN-01
124,pu124,1,13-JAN-01
>
The first record IS NOT effective for dates prior to 12-JAN-01. In fact for a query looking for data prior to that date there isn't any data.
The first record is also NOT effective for dates on or after 13-JAN-01. Only the second record is effective.
If you added a record for 14-JAN-01 this record would not be effective until on or after that date (i.e. not for another 4 1/2 months).
So for the classic definition of effective date the query needs to provide the AS OF date to use to obtain the data. If, as in your system, you are not allowed to create records with dates in the future and you just want the latest record then you can just select the record with the MAX(myDate) value for the given person_id, address_id or whatever your key values are.
Edited by: rp0428 on Aug 11, 2012 7:50 AM -
Previous value of same variable
How can I compare previous value of same variable(result) with current value.
Example, result 1 > result 2 or not, result 2 > result 3 or not, result 3 > result 4 or not, result 4 > result 5 or not.
import java.util.Random;
public class Test {
public static void main(String args[]){
double A = 5;
Test Cal = new Test();
Cal.run(A);
void run(double A){
Random random = new Random();
double result;
int i = 0;
do{
i++;
result = A + random.nextGaussian() / 2;
System.out.println(result);
}while(i<5);
}Welcome to the forum.
960130 wrote:
How can I compare previous value of same variable(result) with current value.introduce a temporarry (local) variable that gets the previous value of <tt>result</tt> before the latter is overwritten.
BTW: plese read
https://wikis.oracle.com/display/Forums/Forums+FAQ
Especially section Are there any useful formatting options not shown on the sidebar?
bye
TPD -
Hide value of row-item(in crosstab Template) if same with previous row
Hi,
I've one custom crosstab using the following xml.
group outside crosstab- GTOP - on M_KOG3_CONC
row-item1 -> MARKT_LINE_CONC (group G1)
row-item2 -> S2_SEGMENT2 (group G2)
row-item3 -> RIM_IN_INCH (group G3)
datapoints - QTY_TIRE_SO_FTP, SHARE_FITTED_TIRE, POLICY_FITTMENT_FTP
end G3
<subtotal on S2_SEGMENT2> end G2
<subtotal on MARKT_LINE_CONC> end G1
<grand total on M_KOG3_CONC>
end GTOP <split by page break>
Now for M_KOG3_CONC=574, for MARKT_LINE_CONC='R02: CES - New Tire' and S2_SEGMENT2='CP20: Corporate PKW', 3rows will come for 3 RIM_IN_INCH values. I want to display values of S2_SEGMENT2 and MARKT_LINE_CONC and top-border of the cell only when it changes ie when a group starts.
Cell top-border I couldn't display conditionally. For the value, in formfield of MARKT_LINE_CONC and S2_SEGMENT2 I used
<?xdofx:MARKT_LINE_CONC "third_bracket"not(.=preceding::MARKT_LINE_CONC)"third_bracket"?>
<?xdofx:S2_SEGMENT2 "third_bracket"not(.=preceding::S2_SEGMENT2)"third_bracket"?>
but it hides MARKT_LINE_CONC and S2_SEGMENT2 value for second set of M_KOG3_CONC(=550: INDEP. SMALL) as MARKT_LINE_CONC and S2_SEGMENT2 are coming common from previous M_KOG3_CONC(=574: CHARTERWAY).
Can anyone please give me alternate form field code satisfying this requirement.
<?xml version="1.0" encoding="UTF-8" ?>
<DataSet>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP20: Corporate PKW</S2_SEGMENT2>
<RIM_IN_INCH>15</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>2415</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>3.96226415094339622641509433962264150943E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP20: Corporate PKW</S2_SEGMENT2>
<RIM_IN_INCH>16</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>1442</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>2.36587366694011484823625922887612797375E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP20: Corporate PKW</S2_SEGMENT2>
<RIM_IN_INCH>17</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>10</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1.64068908941755537325676784249384741592E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP20: Corporate PKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>3867</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>6.34454470877768662838392124692370795734E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP22: Competitor PKW</S2_SEGMENT2>
<RIM_IN_INCH>15</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>576</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>9.45036915504511894995898277276456111567E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>2.60416666666666666666666666666666666667E-02</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP22: Competitor PKW</S2_SEGMENT2>
<RIM_IN_INCH>16</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>235</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>3.8556193601312551271534044298605414274E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1.82978723404255319148936170212765957447E-01</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CP22: Competitor PKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>811</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1.33059885151763740771123872026251025431E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>7.15166461159062885326757090012330456227E-02</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT10: Corporate LKW</S2_SEGMENT2>
<RIM_IN_INCH>17.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>327</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>5.36505332239540607054963084495488105004E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT10: Corporate LKW</S2_SEGMENT2>
<RIM_IN_INCH>19.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>350</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>5.7424118129614438063986874487284659557E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT10: Corporate LKW</S2_SEGMENT2>
<RIM_IN_INCH>20</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>6</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>9.84413453650533223954060705496308449549E-04</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT10: Corporate LKW</S2_SEGMENT2>
<RIM_IN_INCH>22.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>480</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>7.87530762920426579163248564397046759639E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT10: Corporate LKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>1163</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1.90812141099261689909762100082034454471E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH>16</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>39</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>6.39868744872846595570139458572600492207E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH>17</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>2</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>3.28137817883511074651353568498769483183E-04</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH>17.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>54</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>8.85972108285479901558654634946677604594E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>3.7037037037037037037037037037037037037E-02</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH>19.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>20</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>3.28137817883511074651353568498769483183E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH>22.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>58</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>9.51599671862182116488925348646431501231E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2>CT12: Competitor LKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>173</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>2.83839212469237079573420836751435602953E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1.15606936416184971098265895953757225434E-02</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R02: CES - New Tire</MARKT_LINE_CONC>
<S2_SEGMENT2 />
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>6014</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>9.86710418375717801476620180475799835931E-01</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>8.46358496840705021616228799467908214167E-01</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT11: Corporate RE LKW</S2_SEGMENT2>
<RIM_IN_INCH>22.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>13</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>2.13289581624282198523379819524200164069E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT11: Corporate RE LKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>13</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>2.13289581624282198523379819524200164069E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH>17.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>29</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>4.75799835931091058244462674323215750615E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH>19.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>18</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>2.95324036095159967186218211648892534865E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH>22.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>21</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>3.44544708777686628383921246923707957342E-03</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>68</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1.11566858080393765381460213289581624282E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2 />
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>81</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1.32895816242821985233798195242001640689E-02</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>1.60493827160493827160493827160493827161E-01</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>574: CHARTERWAY</M_KOG3_CONC>
<MARKT_LINE_CONC />
<S2_SEGMENT2 />
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>6095</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>8.37243642329778506972928630024610336341E-01</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>550: INDEP. SMALL</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH>22.5</RIM_IN_INCH>
<QTY_TIRE_SO_FTP>24</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>550: INDEP. SMALL</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2>CT13: Competitor RE LKW</S2_SEGMENT2>
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>24</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>550: INDEP. SMALL</M_KOG3_CONC>
<MARKT_LINE_CONC>R03: CES - Retreads</MARKT_LINE_CONC>
<S2_SEGMENT2 />
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>24</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
<ROW>
<M_KOG3_CONC>550: INDEP. SMALL</M_KOG3_CONC>
<MARKT_LINE_CONC />
<S2_SEGMENT2 />
<RIM_IN_INCH />
<QTY_TIRE_SO_FTP>24</QTY_TIRE_SO_FTP>
<SHARE_FITTED_TIRE>1</SHARE_FITTED_TIRE>
<POLICY_FITTMENT_FTP>0</POLICY_FITTMENT_FTP>
</ROW>
</DataSet>
Kind Regards.Can anyone please help me on this issue?
Regards. -
How can i select some row from multiple row in the same group of data
I want to select some row from multiple row in the same group of data.
ColumnA
Column B
1 OK
1 NG
2 NG
2 NG
3 OK
3 OK
I want the row of group of
ColumnA if ColumnB contain even 'NG'
row , select only one row which Column B = 'NG'
the result i want =
ColumnA Column B
1 NG
2 NG
3 OK
Thank youThat's some awful explanation, but I think this is what you were driving at:
DECLARE @forumTable TABLE (a INT, b CHAR(2))
INSERT INTO @forumTable (a, b)
VALUES
(1, 'OK'),(1, 'NG'),
(2, 'NG'),(2, 'NG'),
(3, 'OK'),(3, 'OK')
SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
FROM @forumTable f
LEFT OUTER JOIN @forumTable f2
ON f.a = f2.a
AND f.b <> f2.b
GROUP BY f.a -
Compare two rows in a same table
Dear all
I need to compare two rows in the same table, I dont know hoe to do it in pl/sql. Some one please help me on this.
example:
tr br price
xya0001 ama7 12
xya0003 ama6 14
xya0004 ama7 16
in the table tr is a unique value for each row, I need to compare price column and see whether the first value is less or greater than the next value and, if it is greater put the corresponding br value to a variable and if it is smaller put the corresponding br value to another variable. I dont know a method to do it, as I'm new to pl/sql. Some one please help me in thisnot sure what you intend to do as you have mentioned that "TR" is unique and you just want to compare each record with just the next record. Hope below query helps. The value "G" or "L" in flag would indicate if the current records price is greater than or less than the price in next record.
select tr,br,price,col4, case when price> col4 then 'G' when price< col4 then 'L' end flag from (
select tr,br,price,lag(price,1,0) over(order by tr) col4 from testcomp
) -
Grouping consecutive rows with same value?
Hi
I have a table in which three columns are:
ROWID SHOPNAME
1 SHOP_C
2 SHOP_A
3 SHOP_C
4 SHOP_C
5 SHOP_A
6 SHOP_A
7 SHOP_C
8 SHOP_B
9 SHOP_B
10 SHOP_E
11 SHOP_A
12 SHOP_D
13 SHOP_D
14 SHOP_F
15 SHOP_G
16 SHOP_F
17 SHOP_C
18 SHOP_C
19 SHOP_C
20 SHOP_C Rowid is a primary key column with unique ids
Shopname is varchar2 column
I want to make groupings of every "shopname" value "order by ROWID" such that when there are consecutive rows of same shopname the group remains same and as soon as there is different value in shopname column for the next row the "group" changes.
below is my desired output is with 3rd column of groupings as follows:
ROWID SHOPNAME Groups
1 SHOP_C 1
2 SHOP_A 2
3 SHOP_C 3 ------> same grouping because Shop name is same
4 SHOP_C 3 ------> same grouping because shop name is same
5 SHOP_A 4 ----> different shopname so group changed.
6 SHOP_A 4 ----> same group as above because shopname is same
7 SHOP_C 5
8 SHOP_B 6
9 SHOP_B 6
10 SHOP_E 7
11 SHOP_A 8
12 SHOP_D 9
13 SHOP_D 9
14 SHOP_F 10
15 SHOP_G 11
16 SHOP_F 12
17 SHOP_C 13
18 SHOP_C 13
19 SHOP_C 13
20 SHOP_C 13I want that to be done via analytics, so that I can partition by clause for different shops over different cities
regards
Ramis.with data(row_id, shop) as
select 1, 'SHOP_C' from dual union all
select 2, 'SHOP_A' from dual union all
select 3, 'SHOP_C' from dual union all
select 4, 'SHOP_C' from dual union all
select 5, 'SHOP_A' from dual union all
select 6, 'SHOP_A' from dual union all
select 7, 'SHOP_C' from dual union all
select 8, 'SHOP_B' from dual union all
select 9, 'SHOP_B' from dual union all
select 10, 'SHOP_E' from dual union all
select 11, 'SHOP_A' from dual union all
select 12, 'SHOP_D' from dual union all
select 13, 'SHOP_D' from dual union all
select 14, 'SHOP_F' from dual union all
select 15, 'SHOP_G' from dual union all
select 16, 'SHOP_F' from dual union all
select 17, 'SHOP_C' from dual union all
select 18, 'SHOP_C' from dual union all
select 19, 'SHOP_C' from dual union all
select 20, 'SHOP_C' from dual
get_data as
select row_id, shop,
lag(shop) over (order by row_id) prev_shop
from data
select row_id, shop,
sum(case when shop = prev_shop
then 0
else 1
end
) over (order by row_id) grps
from get_data;
ROW_ID SHOP GRPS
1 SHOP_C 1
2 SHOP_A 2
3 SHOP_C 3
4 SHOP_C 3
5 SHOP_A 4
6 SHOP_A 4
7 SHOP_C 5
8 SHOP_B 6
9 SHOP_B 6
10 SHOP_E 7
11 SHOP_A 8
12 SHOP_D 9
13 SHOP_D 9
14 SHOP_F 10
15 SHOP_G 11
16 SHOP_F 12
17 SHOP_C 13
18 SHOP_C 13
19 SHOP_C 13
20 SHOP_C 13
20 rows selected -
Comparing 2 xml tags at the same group level
I have a requirement to compare 2 xml tags, which are the the same group level and have to return a value if the match happens
eg:
<?Order?>
-- <?GROUP A1?>
<?style_1?>meeting<?/style_1?>
<description?>Test_desc<?/description?>
<?/GROUP A1?>
-- <?GROUP A2?>
<?style_1?>conf<?/style_1?>
<description?>Test_desc<?/description?>
<?/GROUP A2?>
-- <?GROUP A3?>
<?style_1?>XYZ<?/style_1?>
<description?>Test_desc<?/description?>
<?/GROUP A3?>
-- <?GROUP B1?>
<?style_2?>meeting<?/style_2?>
<description?>Test_desc_2<?/description?>
<?/GROUP B1?>
-- <?GROUP B2?>
<?style_2?>ABC<?/style_2?>
<description?>Test_desc_2<?/description?>
<?/GROUP B2?>
Now I have to compare Style_2 in Group B with Style_1 in Group A and if any one value matches also, I have to display the description from Group B
Has anyone any idea how to compare 2 group levels which are at the same level
ThanksI need to see your xml. Can you send me your xml file and RTF template to [email protected] I can take a look and try to help.
Thanks,
Bipuser -
Update rows with a sequence which fall under same group.
Hi Friends,
I have sample table with following data :
ID DIV NEW_ID
1 A
2 A
3 B
4 B I want to update the column NEW_ID with a sequence value for the rows with same DIV value.
My result should look like below :
ID DIV NEW_ID
1 A 1001
2 A 1001
3 B 1002
4 B 1002How can I accomplish with a single update ?
Thanks
Raj.This isn't pretty, but it should work ....
ME_XE?create table table1 (col1 number, col2 varchar2(1), col3 number);
Table created.
Elapsed: 00:00:00.04
ME_XE?insert into table1 values (1, 'A', NULL);
1 row created.
Elapsed: 00:00:00.06
ME_XE?insert into table1 values (2, 'A', NULL);
1 row created.
Elapsed: 00:00:00.01
ME_XE?insert into table1 values (3, 'B', NULL);
1 row created.
Elapsed: 00:00:00.00
ME_XE?insert into table1 values (4, 'B', NULL);
1 row created.
Elapsed: 00:00:00.00
ME_XE?
ME_XE?
ME_XE?create sequence s start with 1001 increment by 1;
Sequence created.
Elapsed: 00:00:00.00
ME_XE?create or replace function get_s_nextval
2 return number
3 as
4 o_val number;
5 begin
6 select s.nextval into o_val from dual;
7 return o_val;
8 end;
9 /
Function created.
Elapsed: 00:00:00.54
ME_XE?
ME_XE?
ME_XE?merge into table1 t using
2 (
3 with data
4 as
5 (
6 select --+ MATERIALIZE
7 col2, get_s_nextval as next_value
8 from
9 (
10 select distinct col2
11 from table1
12 where col3 is null
13 )
14 )
15 select * from data
16 ) s
17 on (s.col2 = t.col2)
18 when matched then update set t.col3 = s.next_value;
4 rows merged.
Elapsed: 00:00:00.20
ME_XE?
ME_XE?
ME_XE?select * from table1;
COL1 COL COL3
1 A 1001
2 A 1001
3 B 1002
4 B 1002
4 rows selected.
Elapsed: 00:00:00.03
ME_XE? -
I have a SSRS report which uses a matrix for a crosstab effect.
Each row contains about 10 score values in 10 columns respectively. I need each row to check against the previous row, and i need each score value in each column to be compared to the corresponding column score value in the previous row.
If the current score is greater than the corresponding previous score (in the previous row), then i want to change the background of the cell.
if the current score is smaller than the previous, then it's a different color.
if they are equal, or it's the first row in the matrix table, then leave white.
I have found custom code functions to use in the SSRS expression fields, but every single one of them compares against the previous COLUMN value and not the previous ROW value which is what i need. the "Previous" function would be perfect if i
could use it in a matrix but i can't. (i keep getting error "The use of a Previous aggregate function in a tablix cell is not supported"). looking around it turns out that matrices are arrange in groups and not in rows which is why Previous can't
be used and the only way is with custom code.
Please help. if you have any custom code samples that achieve what i need, please share, or give me advice on how to achieve this.
Thank youI figured it out. Maybe it can help someone else in the future:
Public Shared count as Integer = 0
Public Shared currentRow As Integer = 1
Public Shared MatrixStructures As New System.Collections.Generic.List(Of MatrixStructure)()
Public Shared Function GetCellColor(row as Integer, score as Integer)
If (row > currentRow) Then
count = 0
currentRow = row
End If
count = count + 1
Dim matrixStructure As New MatrixStructure()
matrixStructure.RowIndex = row
matrixStructure.ColumnIndex = count
matrixStructure.ScoreValue = score
MatrixStructures.Add(matrixStructure)
If score = 0 Then
Return "White"
End If
Dim val As MatrixStructure = MatrixStructures.Find(Function(s As MatrixStructure)
Return s.GetRowIndex() = row - 1 AndAlso s.GetColumnIndex() = count
End Function)
If (Not (val Is Nothing)) Then
If val.scoreValue = 0 Then
Return "White"
End If
If score >= val.scoreValue + 2 Then
Return "Green"
ElseIf score <= val.scoreValue - 2 Then
Return "Red"
End If
End If
Return "White"
End Function
Public Class MatrixStructure
Public rowIndex As Integer
Property GetRowIndex() As Integer
Get
Return rowIndex
End Get
Set(ByVal Value As Integer)
rowIndex = Value
End Set
End Property
Public columnIndex As Integer
Property GetColumnIndex() As Integer
Get
Return columnIndex
End Get
Set(ByVal Value As Integer)
columnIndex = Value
End Set
End Property
Public scoreValue As Integer
Property GetScoreValue () As Integer
Get
Return scoreValue
End Get
Set(ByVal Value As Integer)
scoreValue = Value
End Set
End Property
End Class
and to pass the current row number from the expression i use this
Ceiling(RowNumber(NOTHING) / 10)
i divide the row number by 10 because there are ten columns. if you don't know the number of columns, or it's a variable number, then return it from the stored procedure query in the first place. that's what I had to do -
Sum of Values from previous rows in a dynamic table
Hello,
I have a dynamic table has multiple rows (added dynamically via a button). One column in the table is a Quantity column. Another is a Total column. We do not want to keep a running total, but only wish to display a total when the rest of the cells in that row are emty and the previous row(s) has/have values in the Quantity column. The Total is the sum on the Quatnities up to a blank row. Below is a sample. How do I get teh value of the Quantities in the previous rows?
Quantity
Total
5
8
12
25
7
27
34
22
22
Another option might be to put the Total in the last row with data as opposed to the row below the data.
Any ideas?
Regards,
KarlThe script is written to achive your requirement (i.e. the second approach you have mentioned)
You can either contact me at [email protected] to get the sample form created.
Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.
<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeLiveCycleDesignerES_V9.0.0.0.20091029.1.612548" APIVersion="3.1.9277.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2012-02-28T14:04:54Z" uuid="2c561cdf-3377-4e84-9a89-51e740bb2fea">
<template xmlns="http://www.xfa.org/schema/xfa-template/2.8/">
<?formServer defaultPDFRenderFormat acrobat9.0dynamic?>
<subform name="form1" layout="tb" locale="en_US" restoreState="auto">
<pageSet>
<pageArea name="Page1" id="Page1">
<contentArea x="0.25in" y="0.25in" w="197.3mm" h="284.3mm"/>
<medium stock="a4" short="210mm" long="297mm"/>
<?templateDesigner expand 1?></pageArea>
<?templateDesigner expand 1?></pageSet>
<subform w="197.3mm" layout="tb">
<subform name="Subform1" w="190.5mm" h="25.4mm">
<field name="Button1" y="15.875mm" x="60.325mm" w="28.575mm" h="6mm">
<ui>
<button highlight="inverted"/>
</ui>
<font typeface="Myriad Pro"/>
<caption>
<value>
<text>Add Row</text>
</value>
<para vAlign="middle" hAlign="center"/>
</caption>
<border hand="right">
<?templateDesigner StyleID apbx2?>
<edge stroke="raised"/>
<fill/>
</border>
<bind match="none"/>
<event activity="click" name="event__click">
<script contentType="application/x-javascript">
try
Subform2.Table1._Row1.addInstance(1);
//for(var i=0;i<Subform2.Table1._Row1.count;i++)
//xfa.resolveNode("Subform2.Table1.Row1["+i+"].Total").execEvent("exit");
}catch(e)
app.alert(e)
</script>
</event>
</field>
<?templateDesigner expand 1?></subform>
<subform name="Subform2" w="196.85mm">
<subform name="Table1" layout="table" columnWidths="55.916mm 44.47mm" x="38.1mm" y="12.7mm">
<border>
<edge/>
</border>
<subform layout="row" name="HeaderRow" id="HeaderRow_ID">
<assist role="TH"/>
<draw h="10mm" name="Cell1">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Quantity</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<draw h="10mm" name="Cell2">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Total</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<subform layout="row" name="Row1">
<assist role="TR"/>
<field name="Quantity" w="55.916mm" h="9.317mm">
<ui>
<numericEdit>
<border presence="hidden">
<?templateDesigner StyleID aped0?></border>
<margin/>
</numericEdit>
</ui
><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><
para vAlign="middle"/><
border><
edge/><
corner thickness="0.1778mm"/></
border></
field><
field name="Total" w="44.47mm" h="9.317mm" access="readOnly"><
ui><
numericEdit><
border presence="hidden">
<?templateDesigner StyleID aped0?>
</border><
margin/></
numericEdit></
ui><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><para vAlign="middle"/>
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<calculate>
<script contentType="application/x-javascript">
try
var nextRow = xfa.resolveNode("Subform2.Table1.Row1["+(this.parent.instanceIndex+1)+"]"); // Next row of the table
if((nextRow==null || nextRow.Quantity.rawValue == null || nextRow.Quantity.rawValue=="") && Quantity.rawValue!=null) // If there is no more rows OR the next row don't contain any Quantity value
var subTotal = 0;
for(var j=this.parent.instanceIndex;j>=0;j--) // Loop until the previous row has empty value OR reach start of row Index (i.e. 0)
var prevObj = xfa.resolveNode("Subform2.Table1.Row1["+j+"].Quantity"); // locate the previous row's Quantity object
if(prevObj.rawValue == null || prevObj.rawValue=="")
break; // if blank value found, skip the loop
subTotal+= prevObj.rawValue;
this.rawValue = subTotal; // Update the Total value
}else
this.rawValue = null; // Clear the total value
}catch(e)
app.alert(e)
</script>
</calculate>
</field>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<keep intact="contentArea"/>
<?templateDesigner rowpattern first:1, next:1, firstcolor:f0f0f0, nextcolor:ffffff, apply:0?>
<overflow leader="HeaderRow"/>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<proto/>
<desc>
<text name="version">9.0.0.0.20091029.1.612548.606130</text>
</desc>
<?templateDesigner expand 1?></subform>
<?templateDesigner DefaultPreviewDynamic 1?>
<?templateDesigner DefaultRunAt client?>
<?templateDesigner Grid show:1, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?>
<?templateDesigner FormTargetVersion 28?>
<?templateDesigner DefaultLanguage JavaScript?>
<?acrobat JavaScript strictScoping?>
<?templateDesigner Zoom 62?>
<?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>
<?templateDesigner SaveTaggedPDF 1?>
<?templateDesigner SavePDFWithEmbeddedFonts 1?></template>
<config xmlns="http://www.xfa.org/schema/xci/2.8/">
<agent name="designer">
<!-- [0..n] -->
<destination>pdf</destination>
<pdf>
<!-- [0..n] -->
<fontInfo/>
</pdf>
</agent>
<present>
<!-- [0..n] -->
<pdf>
<!-- [0..n] -->
<fontInfo/>
<version>1.7</version>
<adobeExtensionLevel>3</adobeExtensionLevel>
</pdf>
<xdp>
<packets>*</packets>
</xdp>
</present>
</config>
<localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.7/">
<locale name="en_US" desc="English (United States)">
<calendarSymbols name="gregorian">
<monthNames>
<month>January</month>
<month>February</month>
<month>March</month>
<month>April</month>
<month>May</month>
<month>June</month>
<month>July</month>
<month>August</month>
<month>September</month>
<month>October</month>
<month>November</month>
<month>December</month>
</monthNames>
<monthNames abbr="1">
<month>Jan</month>
<month>Feb</month>
<month>Mar</month>
<month>Apr</month>
<month>May</month>
<month>Jun</month>
<month>Jul</month>
<month>Aug</month>
<month>Sep</month>
<month>Oct</month>
<month>Nov</month>
<month>Dec</month>
</monthNames>
<dayNames>
<day>Sunday</day>
<day>Monday</day>
<day>Tuesday</day>
<day>Wednesday</day>
<day>Thursday</day>
<day>Friday</day>
<day>Saturday</day>
</dayNames>
<dayNames abbr="1">
<day>Sun</day>
<day>Mon</day>
<day>Tue</day>
<day>Wed</day>
<day>Thu</day>
<day>Fri</day>
<day>Sat</day>
</dayNames>
<meridiemNames>
<meridiem>AM</meridiem>
<meridiem>PM</meridiem>
</meridiemNames>
<eraNames>
<era>BC</era>
<era>AD</era>
</eraNames>
</calendarSymbols>
<datePatterns>
<datePattern name="full">EEEE, MMMM D, YYYY</datePattern>
<datePattern name="long">MMMM D, YYYY</datePattern>
<datePattern name="med">MMM D, YYYY</datePattern>
<datePattern name="short">M/D/YY</datePattern>
</datePatterns>
<timePatterns>
<timePattern name="full">h:MM:SS A Z</timePattern>
<timePattern name="long">h:MM:SS A Z</timePattern>
<timePattern name="med">h:MM:SS A</timePattern>
<timePattern name="short">h:MM A</timePattern>
</timePatterns>
<dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols>
<numberPatterns>
<numberPattern name="numeric">z,zz9.zzz</numberPattern>
<numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern>
<numberPattern name="percent">z,zz9%</numberPattern>
</numberPatterns>
<numberSymbols>
<numberSymbol name="decimal">.</numberSymbol>
<numberSymbol name="grouping">,</numberSymbol>
<numberSymbol name="percent">%</numberSymbol>
<numberSymbol name="minus">-</numberSymbol>
<numberSymbol name="zero">0</numberSymbol>
</numberSymbols>
<currencySymbols>
<currencySymbol name="symbol">$</currencySymbol>
<currencySymbol name="isoname">USD</currencySymbol>
<currencySymbol name="decimal">.</currencySymbol>
</currencySymbols>
<typefaces>
<typeface name="Myriad Pro"/>
<typeface name="Minion Pro"/>
<typeface name="Courier Std"/>
<typeface name="Adobe Pi Std"/>
<typeface name="Adobe Hebrew"/>
<typeface name="Adobe Arabic"/>
<typeface name="Adobe Thai"/>
<typeface name="Kozuka Gothic Pro-VI M"/>
<typeface name="Kozuka Mincho Pro-VI R"/>
<typeface name="Adobe Ming Std L"/>
<typeface name="Adobe Song Std L"/>
<typeface name="Adobe Myungjo Std M"/>
</typefaces>
</locale>
</localeSet>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47 ">
<
rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><
rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""><
xmp:MetadataDate>2012-02-28T14:04:54Z</xmp:MetadataDate><
xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool></
rdf:Description><
rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""><
pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer></
rdf:Description><
rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about=""><
xmpMM:DocumentID>uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea</xmpMM:DocumentID></
rdf:Description><
rdf:Description xmlns:desc="http://ns.adobe.com/xfa/promoted-desc/" rdf:about=""><
desc:version rdf:parseType="Resource"><
rdf:value>9.0.0.0.20091029.1.612548.606130</rdf:value><
desc:ref>/template/subform[1]</desc:ref></
desc:version></
rdf:Description></
rdf:RDF></
x:xmpmeta></xdp:xdp> -
SSRS 2008R2 : Not able to use Previous aggregrate function in matrix columns cell
Hi Expert,
I have used a matrix tablix in my report. It is working fine. But when I am trying to use Previous aggregrate in one matrix column cell I get the below error:
The use of previous aggregrate function ia a tablix cell with in 'Tablix1' is not supported.
Please help me regarding that.
Thanks RanaHi Rana,
In your scenario, you use previous function in the “Data” cell, right? Previous function cannot be used in the overlapping parts of row group and column group. One workaround of this issue is use custom code to get the previous value.
Public Shared previous as Integer
Public Shared current as Integer
Public Shared Function GetCurrent(Item as Integer) as Integer
previous=current
current=Item
return current
End Function
Public Shared Function GetPrevious()
return previous
End Function
Then you can use the expression below in the “Data” cell to get the previous value:
=Code.GetCurrent(fields!Score.Value) & "-Previous-" & iif(Code.GetPrevious()=0,"",Code.GetPrevious())
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
Using the Previous Row in a Calculator Formula
Hello. I am using the calculator to create a new channel that is a custom filtered version of an existing channel. Unfortunately, I have not been able to identify the previous row entry in the channel. To make things easier, let's say my filter is a simple averager. Here is simple pseudocode for what I want to do:
New_Channel = (Existing_Channel[n] + Existing_Channel[n-1]) / 2
where n is the current row.
This is the calculator formula I have come up with:
ch("[1]/New_Channel") = (CHD(chnRow - 1, "[1]/Existing_Channel") + ch("[1]/Existing_Channel")) / 2 + CTNV(chnRow > 1)
Unfortunately, I think chnRow only returns 0.
Obviously, I am a beginner. I am open to other approaches to creating a new channel with a custom filter.
Thanks!
Solved!
Go to Solution.Hi jbuttron,
What you need to do is to copy the channel and delete the first value from the copied channel-- then the Nth row of the original channel will line up with the (N-1)th row of the copied channel. You should also add the last value of the copied channel to the end of that channel as a new value so both channels end up with the same channel length. Now you can reference the channels with Ch("[1]/old") and Ch("[1]/new") in the channel calculator expression, assuming that the channel names are "old" and "new" respectively and that both are in the first group. You don't need a row variable in the expression now, which is good because there's no way to iterate a row variable in a channel calculator expression. The row iteration is implicit in the channel referencing Ch("[1]/new").
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Hello,
The use case is each row logs a cumulative data point, like an odometer, and I need to be able to subtract a previous row from a following row in order to see the change between two rows.
I can do this if I create a Power Query "From Table," but if I do the same thing when the data source is SQL, I get an error message "invalid attempt to call Read when reader is closed".
Given a trivial data table, this works:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1),
#"Added Index1" = Table.AddIndexColumn(#"Added Index", "Index.1", 1, 1),
Merge = Table.NestedJoin(#"Added Index1",{"Index.1"},#"Added Index1",{"Index"},"NewColumn"),
#"Expand NewColumn" = Table.ExpandTableColumn(Merge, "NewColumn", {"Odometer"}, {"NewColumn.Odometer"})
in
#"Expand NewColumn"
But attempting the same technique against data from SQL, I get the above error "invalid attempt to call Read when reader is closed".
Any suggestions? If this is a feature (or bug) that can't be overcome, is there another way to compare values between two rows?
Thanks,
EdPlease use "send a frown" to report the bug so we can fix it. Is the data very big? The simplest workaround is likely to be the use of "Table.Buffer" to buffer the table locally before doing this work; that will cause us to stop any
attempt to do the processing on the server. If the table is very big, though, this isn't an attractive approach.
Maybe you are looking for
-
hey guys, I'm using wordpress to host my podcasts. I put up to podcasts, in one page on my site (not as new 'posts' but two links on a page) and made a feed for that page. I submitted the feed to itunes over a week or two ago, and my older podcast sh
-
Is it possible to move items into Family calendar?
Is there a way to move the items I have in my Calendar into the new Family Calendar?
-
How to get failed tasks list for a user in OIM.
Hi All, Can anybody please suggest me a way to get list of task that got failed(when a user trying to provision to a resource) in OIM using java code. Thanks in Advance. SP.
-
I was running 2007.05 great for a while...prolly close to a month. I rebooted about 2 days ago and i got a kernel panic and i couldn't figure out why (i tried the fallback kernel and some other stuff to troubleshoot too), from that i decided to reins
-
Hi, I am trying to place a 9.75 in x 7.5 in image into an InDesign document (actually a template given to me by a client). I am replacing the current image with a new image. When I place the image into ID by relinking the current image, the new image