Use first row of table to determine calculation of rest of the rows of that table.

I have time sheet table where the rows are employees names and the column is the dates in the calender
Name
01
02
03
04
05
06
07
08
09
Emp 1
8
8
8
8
8
0
0
8
8
Emp 2
8
7
8
9
8
0
0
8
7
Emp 3
6
8
8
8
8
0
0
8
8
I want to come up with this table - where '1' indicates the public holiday.
Name
01
02
03
04
05
06
07
08
09
1
Emp 1
8
8
8
16
8
0
0
8
8
Emp 2
8
7
8
18
8
0
0
8
7
Emp 3
6
8
8
16
8
0
0
8
8
** I have the public Holiday table with dates of public holidays. I can do UNION ALL with sheet table and Public Holiday table to get the first row. i.e. if there is a Public Holiday within that date range then it will have '1' in the corresponding field
of the first row.
** Now If the there is a '1' in a field of the first row, I want all values below it to be doubled as shown in the example.
Please point me in the right direction.
Marsh Narewec

create table test (Name varchar(20),[01] int,[02] int,[03] int,[04] int,[05] int,[06] int,[07] int,[08] int,[09] int)
insert into test values('Emp 1',8,8,8,8,8,0,0,8,8),('Emp 2',8,7,8,9,8,0,0,8,7),('Emp 3',6,8,8,8,8,0,0,8,8)
;with mycte as(
select name, val,col from (select * from test) src
cross apply (values([01],'01'),([02],'02'),([03],'03'),([04],'04'),([05],'05'),([06],'06'),([07],'07'),([08],'08'),([09],'09')) d(val,col)
Select name,[01],[02],[03],[04],[05],[06],[07],[08],[09] from
(select name, Case when col='04' then val*2 else val end val,col from mycte) src
PIVOT (max(val) For col In ([01],[02],[03],[04],[05],[06],[07],[08],[09])) pvt
drop table test

Similar Messages

  • I have created PDF from hardcopy by using my scanner. After I run OCR option for my PDF by using Acrobat Pro 9. But "Text-to-speech" functionality of the PDF says that an error message comes up that says the page is empty when I turns on the read out loud

    I have created PDF from hardcopy by using my scanner. After I run OCR option for my PDF by using Acrobat Pro 9. But "Text-to-speech" functionality of the PDF says that an error message comes up that says the page is empty when I turns on the read out loud option in Acrobat. Kindly help me to sortout this problems?

    So I tried generating the same PDFs on two other computers that have Acrobat 9 Pro.  Results were reproduced.  The verdict is:
    - complex PDF files (that is, containing cross-references, tables of contents, and bookmarks) generated by Acrobat 9.x Pro are roughly 2-5x larger than the identical file generated with Acrobat 8.x Pro.
    - different PDF conversion settings make a negligable difference (less than 10% rather than 70-80%).
    - using the "Reduce File Size" or "Optimize PDF" option cuts the file size roughly in half, almost always resulting in a "image downsampling mask" warning message, which requires acknowledgement (that is a problem for batch processing or automation).
    - adding an Acrobat watermark to the file cuts the file size roughly in half.
    - just using Save As to another filename has no effect on file size.
    - generating the PDF in Acrobat 9 with links but no PDF bookmarks still results in the inflated file size.
    - generating the PDF in Acrobat 9 without any links or bookmarks results in approximately the same file size as the Acrobat 8 PDF with full links and bookmarks.
    It appears that Acrobat 9's manner of adding links is what's bloating  the files, and in my case it's probably not related to images or image resolution/print quality.  It's a shame, because Acrobat 9 seems to have made some  improvements to the Review Tracker interface, and a few other bells and  whistles which I haven't really gotten around to exporing yet.  But  unless I find a way to keep my links and the PDF file sizes comparable to what I was  getting with Acrobat 8 Pro, it looks like I'm going to stay with Acrobat 8.

  • I need to  know the name of the database table and the fields in that table

    hi,
    i need to I need to  know the name of the database table and the fields in that table for the following fields of the front end .
    1) incident details.
    2) ownership details
    3) injury type
    4) % of investigation completed withen 7 days.
    5) count of incident type
    6) cost of workers compensation claim.
    7) injury resulting from for workers compensation claim
    8) investigation free text.
    9) investigation contribution factors.
    10) investigation root cause.
    11) investigation root cause free text
    12) employee risk assesment
    13) protential infrigment notice issued
    14) actual infrigment notice issued.
    15) actual infrigment notice reference number.
    16)vehicle damaged text.
    18) when the incident occured.
    thanks and regards,
    pronoy .

    Hello,
    Check CCIHT* under se16 and search for relevant information
    Thanks
    Jayakumar

  • Hey Apple I want to buy my first time there and do it and do not remember the security question that I want to. Please tell us what they can do.

    Hey Apple
    I want to buy my first time there and do it and do not remember the security question that I want to.
    Please tell us what they can do.

    Welcome to the user to User Technical Support Forum provided by Apple
    Houshiar wrote:
    do not remember the security question
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions

  • Calculating total discount at the row level

    Hi,
    I want to determine the total discount amount for all of the invoice row levels by summing the row totals that have the same discount % and then multiplying that total by the row discount percent.
    Example:
    Lets say there is an invoice with 3 line items
    Qty     ItemCode     Price    Discount%
    2         A                $30            10
    2         B                $20            10
    2         C                $15             5
    I want to figure the total for the first 2 lines (because they have the same discount amount) by multiplying the quantity (230)+(220)=100 and then calculating the discount from this total. (100) * (.10) = $10 and then calculating the discount for the third line item ((215).05)=1.5. This brings the total discount amount to $11.50.
    Below is what I have drafted for a query so far.
    Select
    //For each grouping of items with the same discount %
    (SUM ((T0.Quantity * T0.PriceBefDi)) * DiscPrcnt)
    FROM INV1 T0 WHERE T0.DocEntry=$[OINV.DocEntry]
    Any ideas?
    Thanks,
    Luke

    Gordon,
    I was thinking that I would have to use a group by (grouping on the discount %) statement or possible a sub-query to accomplish this. The group by statement would replace the commented section. "//For each grouping of items with the same discount %"
    I will work on this query some more and post my results if I figure out a way to accomplish this.
    Thanks,
    Luke

  • Freeze column headers in a table and enable vertical scroll bar on the rows

    I have seen demos of BI Publisher running an html view of a report that displays a table of data with a vertical scroll bar on the table. The table header is always visible as you scroll down on the rows of the table. Any idea how this is achievable?

    Hi,
    Have you find a way to do this? Im looking for the exact same thing!
    Where did you see this demo?
    Br
    Magnus

  • When I connect my Macbook air to my TV, using a Mini Display Port/HDMl adaptor and an HDMl cable, the only thing that appears on the TV screen is the Air's background screen,

    When I connect my Macbook Air to my TV via the thunderbolt outlet and using a Mini Display Port/HDMl adaptor, the only image that appears on the TV screen is that of my Air background. There is obviously a signal getting through to the TV, but it is not sending images of anything else, and am unable to watch video through my Air. Any advise/suggestions?

    This is called "extended desktop mode".  It's an extension of the desktop off to the right (by default) of your MBair screen.  Grab an app and drag it off the right side of your MBair screen and it will appear on the TV.
    To mirror your MBair screen on the TV you can press Command F1.  This will toogle between mirror and extended desktop.
    You can find all the settings in System Preferences > Displays > Arrangement tab.
    Regards,
    Captfred

  • How to find the relation between that tables

    Hi,
      I have to get the data from different tables but I dont have any table relation ship. So If any body can help me to get that relation ship that will be very helpful for me.
    my tables are
    LFA1     
    LFB1
    LFC1
    RFSDO
    BSIK     
    Thanks
    Imran

    >
    SURINDER SINGH OBEROI wrote:
    > Hi,
    >
    > LFA1-LIFNR = LFB1-LIFNR = LFC1-LIFNR = BSIK- LIFNR
    > LFB1-BUKRS = LFC1-BUKRS = BSIK-BUKRS
    > LFC1-GJAHR = BSIK-GJAHR
    > LFC1-ERDAT = BSIK-AUGDT
    >
    > Cheers,
    > Surinder
    You think, you can fetch accurate data with the above mentioned linkages?
    Oh btw, the question i believe the question was How to find the relation....
    pk

  • Itunes could not connect to the ipod becasue it is locked with a passcode. You must enter your passcose on the ipod before it can be used. BUT i cant unlock it and i dont have the original itunes that is was hooked up with before either. HELP!

    "itunes could not connect to the ipod becasue it is locked with a passcode. You must enter your passcose on the ipod before it can be used" BUT i cant unlock it and i dont have the original itunes that is was hooked up with before either. HELP! It wont let me restore because it is locked. I cannot unlock it. I have tried everything online. nothing works.

    Place the iPod in recovery mode and then restore the iPod to factory defaults/new iPod.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore

  • Why did iso7.1.1 change the ability to see your apps when you use four fingers to partly close the app your in. In 7.1 you could use four fingers to partly close a app and see all the apps on that home screen. I used this all the time to check the date

    Why did ISO 7.1.1 change the feature where you could use four fingers to close an app and see if he other apps on your home screen as you were closing an app. This was the handiest feature I thought because I could partially close the app I was working in and see the  date or other things on my home screen and then released the four finger position and be right back to the app I'm working in. Please change this in the next update back to the way it was!!!!!

    I get the multitasking list (all prior apps, scrollable) and can switch to an app, swipe up to force it closed instead of "at rest" and can click back to the originating app in the same place i was prior to the swipe,

  • Transport of total table contents iso only the changes within that table

    Dear experts,
    Due to some errors i'm now stuck in a situation where in DTAP clients a custom built table is not consistant any more. e.g. In T(est) client some entries exist that are not present in D(evelopment) any more. Modifications of entries in the table will result in a transport only containing the modifications.
    I'm looking for a way that I can overwrite (delete and re insert) the whole table in the DTAP clients in stead of only the modifications.

    you should be able to create a transport and manually add the table entries.
    SE10 and create a transport, and workbench request.
    double click to get to the objects screen and go to change mode.
    entry program id : R3TR
    object : TABU
    Object name : your z table name
    you will see a key symbol appear on the line, click this,
    then double click the empty line to add the key field values of the entries you want to add to the transport.  You should be able to find wild card values to select all entries of the table.
    on the tool bar is a 'table contents' specified by the key entries which will let you test select the entries from the table.
    This transport can then be released and transported.

  • Getting only the rows committed in the database

    Hi,
    I have one strange requirement in my application.
    I need to fetch the rows from a particular table in the database which are committed.
    I mean there are other view objects for that table and those view objects are manipulating the data in that table and doing postChanges(). But I need a way (may be using a view object or any other technique) for getting the rows which are COMMITTED in the database and not just posted using postChanges().
    Please advice how can I achieve this.
    Thanks

    Hi,
    I have one strange requirement in my application.
    I need to fetch the rows from a particular table in the database which are committed.
    I mean there are other view objects for that table and those view objects are manipulating the data in that table and doing postChanges(). But I need a way (may be using a view object or any other technique) for getting the rows which are COMMITTED in the database and not just posted using postChanges().
    Please advice how can I achieve this.
    Thanks

  • Scroll all the rows in a table except the first row

    I have an HTML table
    for eg...
    <html>
    <div style="height:100px;overflow:auto">
    <table>
    <tr><td>xyz</td></tr> ///this row should not scroll
    <tr><td>123</td></tr> ///the rows repeated 100 times to allow scrolling
    </table>
    </div>
    </html>
    it gives me a nice table with a vertical scroll bar. What I want is my first row should not scroll. The scroll bar should be applicable from rows 2-100. I am not able to use this <div> tag exclusively to <tr>. Any inputs as to how this can be achieved.
    Raghav

    The whole problem is I lose the table alignment. if I have a table like
    <table>
    <tr><td>heading1</td><td>heading2</td><td>heading3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    //so on
    </table>
    all my rows from 2-99 are aligned properly under the first row.
    If I have a <div > tag or a new table for row "2-99"..the alignment is gone. "value1", value2 and value3 dont fall exactly under "heading1" "heading2" and heading3 respectively. I hope I made my point.
    <table>
    <tr><td>heading1</td><td>heading2</td><td>heading3</td></tr>
    <tr><td>
    <div style="height:100px; overflow:auto">
    <table>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    <tr><td>value1</td><td>value2</td><td>value3</td></tr>
    //so on
    </table>
    </div>
    </td></tr>
    </table>
    Raghav

  • Return the rows of the table where a column contains a specific value first

    I want my query to return the rows of the table where a column contains a specific values first in a certain order, and then return the rest of the rows alphabetized.
    For Example:
    Country
    ALBANIA
    ARGENTINA
    AUSTRALIA
    CANADA
    USA
    Now i want USA and CANADA on top in that order and then other in alphabetized order.
    Edited by: 986155 on Feb 4, 2013 11:12 PM

    986155 wrote:
    If it is 2 then i can write a case... i want generalised one where may be around 5 or 6 mentioned should be in descending order at the top and remaining in ascending order there after.Computers tend not to work in 'generalized' ways... they require specifics.
    If you store your "top" countries in a table you can then simply do something like...
    SQL> ed
    Wrote file afiedt.buf
      1  with c as (select 'USA' country from dual union
      2             select 'Germany' from dual union
      3             select 'India' from dual union
      4             select 'Australia' from dual union
      5             select 'Japan' from dual union
      6             select 'Canada' from dual union
      7             select 'United Kingdom' from dual union
      8             select 'France' from dual union
      9             select 'Spain' from dual union
    10             select 'Italy' from dual
    11           )
    12      ,t as (-- top countries
    13             select 'USA' country from dual union
    14             select 'United Kingdom' from dual union
    15             select 'Canada' from dual
    16            )
    17  select c.country
    18  from   c left outer join t on (t.country = c.country)
    19* ORDER BY t.country, c.country
    SQL> /
    COUNTRY
    Canada
    USA
    United Kingdom
    Australia
    France
    Germany
    India
    Italy
    Japan
    Spain
    10 rows selected.

  • Table.rows.find() returns null in a table where the row exists.

    Hi...
    I am working in a Project in Visual Studio 2013 where I have to read an Excel report related with a list of business opportunities. Some of the Fields that are involved in it are:  Opportunity ID, BU, Account, close date, Account Manager,
    Total Value and so on. As soon as I get the conection with the Excel Report, I fill a DataTable and declare the columns [Opportunity ID] and [BU] as my Primary Keys.  In that way, an Opportunity value may have one o more rows
    with different BU code each of them.  In consequence, you can define one row in the table if you specify the [Opportunity ID] and the [BU] values.
    My problem starts when I try to get information of those rows that have an specific value of [Opportunity ID]. For that situation I make a "foreach" structure where I check the BU codes that are involved with that Opportunity. So
    I use the Find() Method to get the information of the row specified by the Opportunity ID and BU.  The first time it goes to find the information it gets the results successfully but in the next cycle changing just the [BU] using the same [Opportunity
    ID] value, the find() method returns a "null" and I do not know why because I am sure that the row exists in the table.  I have verified the "Unique" property for the  [Opportunity ID] and [BU] columns (which are
    my primary keys)  and they are in false which is OK.
    I share the code that I am using...
    Hope someone can help.
    Thanks.
    Alfmar.
    void ObtenTotalesxBUs(string Opportunity, string[] BUs, Object[] TotalBUs, Object[] ExpTotalBUs)
    ArrayList TotalesBUs = new ArrayList(); //Required information from the row.
    ArrayList ExpTotalesBUs = new ArrayList(); //Required information from the row.
    foreach(string businessUnit in BUs)
    Object[] LlaveBusqueda = { Opportunity, businessUnit }; //Provide values to the Primary Keys.
    DataRow RenglonInfo = null;
    RenglonInfo = TablaFunnel.Tabla.Rows.Find(LlaveBusqueda); //Find method receives the Primary Keys values. Here is where I have a "null" in return the second time changing just the [BU] field.
    TotalesBUs.Add(RenglonInfo["Total"]); //Get the required information from the row.
    ExpTotalesBUs.Add(RenglonInfo["Expected Total Value"]); //Get the required information from the row.
    TotalBUs = TotalesBUs.ToArray();
    ExpTotalBUs = ExpTotalesBUs.ToArray();}

    Hi Viorel..
    Thanks a lot for you help.
    I am absolutely sure that the second ítem of BU is valid and exist in the table because I tried to make a "Select" statement in the table providing the values of [Opportunity ID] and [BU] and I get the expected record. So, why is not
    working using Find() with the defined Primary Keys??? 
    I tried this in order to test that the record exists...
    if(RenglonInfo == null)
    string strSelect = "[Opportunity ID] = '0000218256' AND [BU] = 'SFW'";
    RenglonInfo2 = TablaFunnel.Tabla.Select(strSelect);

Maybe you are looking for

  • Error message after upgrading to 7.3

    i upgraded to iTunes 7.3 and i got a message that said something about some files were missing and i needed to uninstall and try again. i uninstalled it and now i can't even download iTunes. i can download but i can't do anything else. anybody else h

  • What is the easiest way to edit song info in iTunes?

    I had Windows Media Player as my default for ever on my computer. iTunes doesn't let you right-click to edit songs like WMP and I'm trying to get all my stuff off "Unknown album/title" etc. since for some reason when I imported everything it couldn't

  • Cannot adjust screen brightness in Windows 8.1 on my G50-45

    Hello there, I just bought my new lenovo and instantly upgrade the system software into Windows 8.1. Everthing looks fine instead of the screen brightness adjustment, i've downloaded the latest graphic drivers but nothing happened. The display adapto

  • Trying to find out phone number in new flat

    Hi, My fiancee and I have recently moved into our new flat, sorted out the rest of utilities and now moving on to setting up the internet.  We've found a provider we like, but they need the phone number for the flat to check what kind of service they

  • Does Premiere pro cs2 support: 1920 x 1080 - 60fps - 32-bit @ 48khz?

    I'm having a hard time importing footage with the specs above with Premiere pro cs2.  The video is choppy.  Audio seems to be synced. Help...