Combining multiple records into a single record (View)

Okay so here is my scenerio:
There is a table I have made that details SQL jobs and the various details about them. What i wan't to do is make a view with specific logic implemented. Fields that will be taken across to this view will be: LastRunDate, LastRunTime and Step_Status.
JobName will also be used to define the logic but will not be a column in itself.
What i wan't is an additional column using this logic, called 'DataSet'. For each Dataset there are multiple jobs that are unique to it, so there are multiple records being brought over from the table to view for one particular dataset. For example,
for 'ExampleDataSet' there are three jobs, i wan't it so these jobs are combined and named as 'ExampleDataSet' under a calculated column called 'Dataset'. For the following fields i would like it so that LastRunDate and LastRunTime are the time in whichever
job was last to be intitiated is the date and time set. For Step_Status, there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running'. If neither are running yet one has failed then 'Failed'.
Only when all three have succeeded should it then be set to 'Succeeded'.
I hope i have made that clear enough, please feel free to ask any questions if not. I am relatively new to SQL but i thought to at least try least try (I knew it wouldn't work) and it didn't work. But it may give you a better idea of
what i wan't:
CREATE VIEW [dbo].[vw_DataAvailabilityAnalysts] AS
SELECT CASE
WHEN JobName in ('Job1','Job2','Job3') and step_status='Running' THEN 'Running'
WHEN JobName in ('Job1','Job2','Job3') and step_status='Failed' THEN 'Failed'
WHEN JobName in ('Job1','Job2','Job3) and step_status='Succeeded' THEN 'Succeeded'
END as StatusCheck,
CASE WHEN JobName in ('Job1','Job2','Job3') THEN 'ExampleDataSet'
END as DATASET,
LastRunDate,
lastruntime,
step_status,
FROM [CDS_Common].[dbo].[DataAvailability]
Many Thanks,
Plain_Clueless
Plain_Clueless

Okay so here is what my table looks like (Simplified). There are four columns and the data within is extracted via a Stored Procedure.
JobName
LastRunDate
LastRunTime
Step_Status
Job1
11/06/2014
09:30:00
Succeeded
Job1
10/06/2014
09:37:20
Succeeded
Job2
11/06/2014
04:05:00
Succeeded
Job1
09/06/2014
02:17:41
Succeeded
As you can see there are 3 jobs which are all 'Job1'. This jobs are obviously different within the table however this represents that they are jobs which all update the same DataSet within our local warehouse. Whereas Job2 updates a different dataset alltogether.
I wan't to create a view which will alagmate the jobs that are of the same DataSet, which will disclude the column JobName but would create a whole new column that looks like this:
DataSet
LastRunDate
LastRunTime
Step_Status
DataSet2
11/06/2014
04:05:00
Succeeded
DataSet1
11/06/2014
09:30:00
Succeeded
Bascically what this shows you is all the Job 1's combined so they are one record, Amaglamated. The last time any of these jobs were run is the LastRunDate & LastRunTime, which was the first record in the first table provided. Again for Step_Status,
there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running' (Absolute). If none of the three jobs are running yet one has failed then 'Failed'. If one has failed yet another is also running then
'Running'.Only when all three have succeeded should it then be set to 'Succeeded'. (This last bit isn't as important).
Hope this clears it up a bit,
Plain_Clueless
Plain_Clueless

Similar Messages

  • Concatenate multiple records into one single record

    Hello everyone,
    Can anyone guide me how to merge multiple records into one single record
    like......... I am getting the data in the file like
    aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
    ffffff/gggg/hhhhhhhhhhhhhh
    /123/4567/55555/99999999/kaoabfa/eee
    fffff/kkkkkkkk/llllllllllllllllllllllll
    when i use gui_upload I am getting the data into the internal table in the above format.
    My main intension is to split the record at / to multiple lines and dowload it into another file.
    What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.

    Yes, it should work.
    In my example
    Loop at itab.
    concatenate i_text itab into i_text.
    endloop.
    You change that loop for the loop of your internal table with the file records
    So if you have this three records
    'aaaa/bbb/ccc'
    '/dddd/efg'
    'hijk/lmn'
    i_text will look like this at the end
    'aaaa/bbb/ccc/dddd/efghijk/lmn'
    then in this part of the code
    split i_text at '/' into table itab2.
    itab2 will have the records looking like this
    aaaa
    bbb
    ccc
    dddd
    efghijk
    lmn'

  • Combining multiple lists into a single list

    Hi, 
    I have created 5 different lists within the same sharepoint site. These lists have some common fields among them for example each list has same fields such as "Country", "Unit", "Review Name" etc. I now want to create a single
    list that will have show only the common fields present in each list. Could you please advise if this can be done and if so how?
    Thanks, Aarti

    To have a full fledged synchronization between 5 lists will be very complicated.
    If the 6th list is a read-only / view only, I would recommend you to create Lists 1, 2,3,4 and 5 as a custom content type.
    Then you can put a Content Query Web Part that filters out your custom content type and combines the content from the three lists.
    or create a  workflow to update the data when new item is added in other lists
    Check the similar post
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2480cdbe-acb4-434f-9866-cf716cad0994/combining-multiple-lists-into-a-single-list?forum=sharepointadminlegacy
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/5a853466-7480-438a-b32d-3ad6d34347ef/combine-lists?forum=sharepointdevelopment

  • Hiding filenames when combining multiple files into a single .pdf

    I'm fairly new to this Acrobat X. I'm trying to assemble my portfolio to distribute to employers but I cannot seem to get rid/hide the filenames in the final pdf file. I was using the option to 'combine multiple files into a single pdf' because I was compiling images and documents to a single readable pdf file. I got all that done but once I open it, I'd see that each page would still contain the original file names rather than page numbers - which I prefer not to have employers see for the sake of tidiness (and I refuse to use the Adobe portfolio because it's not really efficient on space or design. I prefer a simple page-by-page pdf). So I was wondering if anyone can tell me how to hide my file names, change them into page numbers or getting rid of them all together so the 'Table of Contents' in the pdf preview mode would not show anything, I would really much appreciate it.
    -Ss

    Well, when the .pdf is in the final, deliverable form; I open it in Mac preview mode and the sidebar is always extended showing a 'table of contents' rather than having each document in the pdf file have a number designating a page name, it shows each individual filename the pdf is composed of. Not too sure about bookmark, though. Thanks for the reply!
    If you want, I can send the file to you.

  • Append or combine multiple IDOCs into a single IDOC file

    Hi All,
    We are implementing multiple new payment types that will generate IDOC files for us to send to the bank.  To keep the cost to the minimum, the requirement is to combine multiple IDOCs to a single file.
    I'd like to know the most efficient way to complete this task.  Also, I am new to this forum, please let me know if I need to include additional information.
    Your help will be deeply appreciated.
    Thank you,
    Joanne T.

    Hi Milind,
    One way you can do this is generate each report in PDF or Postscript, and then use Adobe Acrobat Distiller to combine the files into one PDF document.
    Regards,
    Stewart

  • Is there a way to combine multiple pages into a single document?

    In the program "Pages," is there a way to combine multiple pages in a single document?

    Jean Louis Gassee, who used to be a senior Apple executive, wrote on Apple's bad approach to the latest iWork suite:
    https://discussions.apple.com/message/25209121#25209121
    Peter

  • Combining multiple files into a single PDF/A

    The issue brought up in another discussion is the loss of PDF/A conformity when “merging” multiple PDF/A files into a single file (I use PDF/A for preservation of corporate records). The “insert” option retains conformity but does not allow inserting multiple files in a certain order, unless you insert them one by one (which is a pain when you have 50 files to attach).
    The solutions I’ve come up with so far:
    1)     1)  In AAPro – combine files into a single PDF and then convert it to PDF/A using Preflight. This is easy, my only problem is that I don’t have AAPro (and AAStandard doesn’t convert to PDF/A).
    2)     2)  In AAStandard – combine files into a single PDF and then “print” to PDF/A. The problem of this “re-frying” is that it only creates PDF/A-1b (not 1a), bookmarks and OCR of scanned pages are lost, and files become significantly larger.
    I wonder if anyone knows a more intelligent way around this problem, provided that I only have AAStandard. Thanks!

    Well, when the .pdf is in the final, deliverable form; I open it in Mac preview mode and the sidebar is always extended showing a 'table of contents' rather than having each document in the pdf file have a number designating a page name, it shows each individual filename the pdf is composed of. Not too sure about bookmark, though. Thanks for the reply!
    If you want, I can send the file to you.

  • How can I map last of the repeating records into a single record?

    I have a following input schema, I need to take only one of the <Student> records and map that to a single record in output. Doesn't matter if the first, second or last one of the records get mapped, I only need one in the output. Any idea how can
    this be accomplished?
    Input:
      <Students>
        <Student id="1">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
          <Student id="2">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
        <Student id="3">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
      </Students>
    Expected Output:
    <Candidate>
      <Student>
        <Name>
           A
        </Name>
      </Student>
    </Candidate>

    Sounds rather complex for something that could be done very simple in custom XSLT like this:
    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="Students">
    <Candidate>
    <Student>
    <Name>
    <xsl:value-of select="Student/Name" />
    </Name>
    </Student>
    </Candidate>
    </xsl:template>
    </xsl:stylesheet>
    Morten la Cour

  • Integrating number of records into a single record

    Hi
    I have a table where we store trainees with certifications, it stores trainees address, id, pass/fail flag, course codes, competetion date and certificate expiration date. WHat I need is to display a single record for each trainee in my query. In this case, what we have currently in the table is we might have 11 certificates for a trainee or 1 or maybe 5 etc. All I need is to display all his information, address, trainee id, courrse code..course code11 in a signle record. Is it possible and how? Please help

    Try this one - it points to the same page and looks like it works:
    Re: How to show the SELECT result in a certain form?

  • Grouping the Records Into One Single Record

    Suggest me any function in sql or script which gives me following result.
    I have a table in which there are few columns and the data looks like below. I am only concerned about 3 columns
    C1 C2 C3
    A B Parent
    B A Child
    My requirement is to club and make it as
    C1 C2 C3 C4
    A B Parent Child
    I need to group in .. If we look into the first 2 records .. c1 of first record is equal to c2 of second record..

    Hi,
    Here's one way to do it:
    SELECT     p.c1
    ,     p.c2
    ,     p.c3
    ,     c.c3     AS c4
    FROM     table_x  p
    JOIN     table_x      c  ON   p.c2  = c.c1
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Point out where the query above is producing the wrong results and explain, using specific examples, how you get those results from the given data in those places.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Can I combine multiple entries into a single statement?

    I am relatively new to Live Cycle so forgive my lack of technical wording.
    I would like to use multiple entry fields to fill in a statement.
    For example:
    I'd like the user to see this:
    Target Dropdown     Endo Dropdown     Type Dropdown     Version # Entry     Date 1 Entry     Date 2 Entry
    and then have the form merge all that together into a line that looks like this:
    RS_(target)_(endo)_(type)\(version)_(date)_(date)
    Preferably without repeating information on the page as we'll have multiple of these entries and the page will get hectic quick.
    Is this possible?
    I first had each dropdown in individual table fields, but due to regulations we follow the entries need to be merged without spaces.
    I always have a backup if this can't be done, but any help is appreciated.

    Not sure where you're sending it, but if you have a global variable named "bob".
    bob.value = "RS_"+target.rawValue+"_"+endo.rawValue+"_"+type.rawValue+"\"+version.rawValue+"_"+date.r awValue+"_"+date2.rawValue;
    Something like that should work.

  • Combining multiple rows into a single row

    Hi all,
    I have a tricky situation in a HR select.
    Imagine I have a dataset as below, simplified of course.
    Name Start Date End date Job Title Salary
    Tom 01/01/07 02/03/08 Gopher £500
    Tom 03/03/08 jobsworth £600
    Rick 04/05/09 Painter £500
    Harry 02/06/07 02/06/08 Gardener £300
    Harry 03/06/08 03/06/09 Runner £200
    Harry 04/06/09 Cook £400
    now, I need to select from above and return 3 rows so it looks as below
    name start date enddate title salary start date enddate title salary start date enddate title salary etc etc
    tom 01/01/07 02/03/08 gopher £500 03/03/08 blah 600
    Rick 04/05/09 painter £500
    harry etc etc etc
    Now, I know how to select onto one row ok, asumming that each employee has a fixed number of roles but the problem is that each employee has a different number of jobs, one could have had 5 while another 50 and I do not know the maximum at this time.
    Anyone have any ideas on how to appraoch this?
    tia,
    dw
    Edited by: derrywriter on Oct 2, 2009 3:50 PM
    Edited by: derrywriter on Oct 2, 2009 3:54 PM

    Ideally this should be done in a suitable reporting tool.
    Standard SQL requires a deterministic number of columns to be known at parse time i.e. before the data is fetched it needs to know how many columns are being returned.
    If you know there is a fixed maximum to the number of columns that can be returned you can use one of the various pivot methods (search the forum) which differ depending on whether you're using 9i, 10g or 11g database.
    If you can't determine a maximum number of columns you're pretty much stuck, unless you want to write some clever interfacing to the oracle ODCI as demonstrated in this thread:
    How to pipeline a function with a dynamic number of columns?
    Personally, I believe such reporting styles should be reserved for reporting tools.

  • To Combine Multiple STOu2019s into Single Delivery

    Hi,
    What are the configuration settings to be done to combine multiple STOu2019s into one single delivery in VL10B. 
    My requirement is to combine multiple STOu2019s contains different DELIVERY DATES and having SAME SUPPLYING AND RECEIVING PLANT into one single delivery.
    Thanks & Regards,
    Victor.

    Hi
    Delivery in STO is created for single order and for same delivery date, same delivery no. for different delivery date and  for multiple STO is not possible and its not logically correct,since after creation of delivery you will be doing picking and packing and Goods Issue.
    Please check
    Kishor

  • Merging two records in a single record for the same matnr,werks and bwart.

    Hi I have a requirement to merge two records into one single record using the quantity field from MSEG table.
    I am selecting two records from the table MSEG. Now for these two records i have to add the quantity values into one variable.
    Then there should be only one record for the same matnr,werks,bwart.
    Any suggestion would be appreciated.
    Regards,
    Amit

    hi,
    You can COLLECT statement only if all non key fields are numeric.
    This statement Adds all such fields and give us a single record.
    Regards
    Sumit Agarwal

  • When combine multiple PDFs into one, some letters are missing and display wrong letter

    Hi all. I get a problem with combine multiple PDFs into a single PDF document. There are some PDF documents and they are working fine to open each document separately. But after I use Adobe Acrobat 8 Standard to combine them into one, some letters are missing and some display wrong letter (e.g. "forums" display "fo ums"). Our company has Adobe Acrobat 8 Standard, Adobe Acrobat 7 Professional and Standard. But all of them have some problem. Does anyone have idea for that? Please help me! Thanks very much!

    I have a similar situation, but my PDFs look fine in Acrobat Pro 8,Acrobat Reader 8, and Apple preview, but are missing letters in Acrobat Pro 7. I think it stems from the files being combined all having the same font, but each having a unique subset stored in the respective files, but with the same name (and ID?), and when they are combined, the character sets are getting hosed somehow.

Maybe you are looking for

  • How to read data from a CLUSTER STRUCTURE not cluster table.

    Hi, how to read data from a CLUSTER STRUCTURE not cluster table. regards, Usha.

  • Run project error message

    -When i try to run my project i get this message : *the correct version of Flash Player does not appear to be installed. try to run anyways.* -then i click *yes* and get an error message *Launching Main has encountered a problem. An internal error oc

  • Allocation error

    After several startup errors, I finally repaired the startup disk with disk utility, and my iMac 24" has been running fine for 5 days.  But this morning I noticed it started to slow down again, and disk utility check said disk corrupted, need to be r

  • Load custom hierarchy (multiple ownership / parents)

    Hi all Lots of questions below, I just need some input on this..:) Thx. in advance.. I have a question regarding loading a custom Customer hierarchy from SAP CRM to SAP BW. The special thing about this hierarchy is that is a leaf (child) can have mul

  • FLV problems

    Hello, I've got some strange problems with flash 8 and importing video files. The problems started yesterday with me creating a streaming flv using the flv playback wizard, the file worked for me locally and online but was not viewable to anyone else