Create only average column calculated date field

Hello

I am creating a single field at the bottom of a report to calculate the average number of days, based on the calculation of the 2 other fields date similar to this example below. I understand that I need a subquery, but can't seem to build the SQL correctly. In the table below is an example of what I'm trying to build, AVERAGE = 7.5.  The SQL code that I use to create the cycle time field that I'm trying to average is "ROUND (GLOGOWNER.» THE INVOICE. DATE_RECEIVED - GLOGOWNER. SHIPMENT_STOP. ACTUAL_DEPARTURE, 0) AS "" DURATION in days".

SELECT ROUND (GLOGOWNER. THE INVOICE. DATE_RECEIVED - GLOGOWNER. SHIPMENT_STOP. ACTUAL_DEPARTURE, 0) IN the 'Cycle time in days.

OF GLOGOWNER. SENDING

JOIN INTERNAL GLOGOWNER. INVOICE_SHIPMENT

ON GLOGOWNER. DELIVERY. SHIPMENT_GID = GLOGOWNER. INVOICE_SHIPMENT. SHIPMENT_GID

JOIN INTERNAL GLOGOWNER. INVOICE

ON GLOGOWNER. THE INVOICE. INVOICE_GID = GLOGOWNER. INVOICE_SHIPMENT. INVOICE_GID

JOIN INTERNAL GLOGOWNER. SHIPMENT_STOP

ON GLOGOWNER. DELIVERY. SHIPMENT_GID = GLOGOWNER. SHIPMENT_STOP. SHIPMENT_GID

JOIN INTERNAL GLOGOWNER. SHIPMENT_STOP SHIPMENT_STOP1

ON GLOGOWNER. DELIVERY. SHIPMENT_GID = SHIPMENT_STOP1. SHIPMENT_GID

WHERE GLOGOWNER. DELIVERY. DOMAINNAME LIKE "UPS/CP/%B".

AND GLOGOWNER. SHIPMENT_STOP. STOP_NUM = 1

AND SHIPMENT_STOP1. STOP_NUM > 1

ACTUAL_DEPARTUREDATE_RECEIVEDCycle in days time
01/07/201414/07/201413
04/07/201406/07/20142
01/08/201411/08/201410
02/08/201407/08/20145
AVERAGE7.5

Thank you very much for the help.

Kind regards

-Adam

Add the "CUMULATIVE" at the end of the group by, and NOT in the select section

SELECT Glogowner.Shipment.Domain_Name AS field

, SUBSTR (Glogowner.Shipment.Servprov_Gid,-4) AS Scac

, Glogowner.Shipment.Transport_Mode_Gid AS 'Mode '.

CASE

WHEN Ir.Insert_Date<= i.insert_date="" then="">

WHEN I.Invoice_Source = 'I' and THEN 'EDI '.

WHEN I.Invoice_Source = 'G' THEN 'debit '.

WHEN I.Invoice_Source = am' THEN 'manual '.

END

AS a Source

, Glogowner.Shipment.Shipment_Xid AS 'Expedition ID ".

, Glogowner.Shipment_Stop.Actual_Departure AS "Delivery Date".

, Shipment_Stop1.Actual_Arrival AS "Delivery Date".

, I.Invoice_Number AS "invoice number".

, I.Invoice_Date AS "Date of the invoice.

, The LEAST (I.Insert_Date, Ir.Insert_Date) AS 'receipt of Invoice Date.

, TOWER (I.Date_Received - Glogowner.Shipment_Stop.Actual_Departure, 0)

AS of the time of Cycle "within days".

INVOICE I have

INNER JOIN Invoice_Refnum Ir ON I.Invoice_Gid = Ir.Invoice_Gid

JOIN INTERNAL Glogowner.Invoice_Shipment

ON I.Invoice_Gid = Glogowner.Invoice_Shipment.Invoice_Gid

JOIN INTERNAL Glogowner.Shipment

ON Glogowner.Shipment.Shipment_Gid =

Glogowner.Invoice_Shipment.Shipment_Gid

JOIN INTERNAL Glogowner.Shipment_Stop

ON Glogowner.Shipment.Shipment_Gid =

Glogowner.Shipment_Stop.Shipment_Gid

INNER JOIN Glogowner.Shipment_Stop Shipment_Stop1

ON Glogowner.Shipment.Shipment_Gid = Shipment_Stop1.Shipment_Gid

WHERE Glogowner.Shipment_Stop.Actual_Departure IS NOT NULL

AND Shipment_Stop1.Actual_Arrival IS NOT NULL

AND Ir.Invoice_Refnum_Value = 'ACS '.

AND Ir.Invoice_Refnum_Qual_Gid = 'SOURCE '.

AND I.Invoice_Type = 'I '.

AND Glogowner.Shipment_Stop.Stop_Num = 1

AND Shipment_Stop1.Stop_Num > 1

GROUP BY ROLLUP (AVG (ROUND (I.Date_Received - Glogowner.Shipment_Stop.Actual_Departure, 0)))

ORDER BY I.Invoice_Gid;

Tags: Database

Similar Questions

  • Create a Multiple Signature and Date fields with a custom toolbar button

    First of all, thank you in advance!  I'm a newbie script and I trudged my way through with very little experience with the scripts of any kind.  I'm good at taking and other scripts and them forming into something I need, but I can't seem to find something to do what I want.

    Use Adobe Acrobat X, I am trying to create a button in toolbar that I can press to create several signature fields and date with predetermined places.

    Here is the script that I have which strives to create a unique signature box, but I can't seem to understand the exact syntax to have this same button create several fields.  In total, it's 9 signature fields and 9 date fields must be created.  If you can give me just one example of what the button would look like with several scripts?  I'm assuming that I put multiple variables, then in ownership cExec toolbar button that I could just scream all these variables?

    var sigswm = "addField ('sigSWM', 'signature', '0', [108, 198, 494.64, 72])"

    app.addToolButton ({cName: "dotbutton", cExec: sigswm, cLabel: "place Signature and Date blocks",});

    Thanks in advance for any help you can provide.

    Billy Sweeney

    This is what works for me:

    function addSignatureAndDateFields (doc) {}

    Add a signature field and a date field

    var swmsig = doc.addField ('sigSWM', 'signature', '0', [108, 198, 494.64, 72]);

    swmsig.setAction ("MouseDown", "getField(\"dateSWM\").value = util.printd (\"mm/dd/yyyy\ ', Date() ");" ') new;

    doc.addField ('dateSWM', 'text', '0', [162, 72, 234, 54]);

    }

    app.addToolButton({)

    cName: "dotbutton."

    cLabel: "place Signature and Date blocks."

    cExec: "addSignatureAndDateFields (this)."

    cEnable: ' event.rc = app.doc; "

    cTooltext: "blocks of Signature and Date place.

    });

  • Select the event to add (or subtract) per day for a date field

    I have a form that gives me a little trouble. I want to be able to enter a start date in a field, and then enter a number of days in another field and then have it calculate a date that is the number of days from the start date. The form is actually work very well most of the time, but there are a few problems I encounter.

    1 end date does not immediately calculate out the number of days. You need to tab all the way back to the start and date only when you leave that field does calculate the end date I need to calculate when you leave the number of days.

    2. I added a small (+) and (-) button to increase or decrease the date by one day. It works, but the problem is, I want to do it in the background. Which means, I want the calculated date to change, but the number of days field not change.

    Tell me if I go on 01/12/2010 to the start date. Then I go 1 in the # of days field. When I tab to the calculated date field, it must immediately change to 02/12/2010. So, if I click on the (+), the date calculated field should go up to 03/12/2010, but the number of days field should stay at 1.

    I downloaded a sample of what I've understood so far:

    https://Acrobat.com/#d=v4c4KKdj0hesicxO8yO1pw

    Thanks a lot for any help I can get on it!

    JO

    I think that's what you're after. I moved the logic to calculate the date event deadline and added a numeric field to store the result of the addition/subtraction (called 'delta').

    Form1. #subform [0]. date2::calculate - (FormCalc, client)

    var date1 = Date2Num(date1.formattedValue,"MM/DD/YYYY")

    $.rawValue = Num2Date(date1+days+delta,"MM/DD/YYYY")

    You could do 'delta' hidden.

    Steve

  • How can I create a PDF form that contains data fields and calculated fields?

    Hello, I need to create PDF forms that has

    -Fields that are read from a MS SQL Server database, once the user enters a field other fields must be read from an underlying database

    -Calculated fields

    what PDF forms product supports this? Once this file created is also filling end-user which form has any kind of special licenses, otherwise he will be able to fill this with Adobe Reader?

    You need to expand the PDF form using Adobe LiveCycle Designer if you want to be able to connect to a database.

    And Yes, it should be possible to use the file in Adobe Reader after that.

    For more questions on LCD forms are trying this forum: LiveCycle Designer

  • Display the field calculated only when there is data

    Hello

    Is there a way to display my value only when the data entry field is used. For example, if I have several fields aligned vertically, I don't want to display a bunch of zeros if their data fields are not used.

    Thank you!!!

    You must write the script in the event of Field2 Calculate.

    The value of the FormCalclanguage.

    if(numPeople.RawValue ne null) then

    numPeople * 12

    endif

    My previous answer shows 2 ways to write the same script. A FormCalc and other JavaScript...

    Thank you

    Srini

  • Calculation of the date fields

    Hello

    I have three fields. 2 are formatted with the date field, and the third for the calculation of the difference between 2 date fields.

    For example, Field1 said August 2012, and field 2 said Sep 2012. Is it possible that I can do field 3 dipslay the 1 (month) response?

    Any help would be greatly appreciated.

    Thank you

    Yes, you use the date object JavaScript extract fields of the whole of the year and the month, create a common denominator for the month and year, and do the math.

    The event of calculation for the number of months:

    Delete the result value

    Event.Value = "";

    get field values

    var sStart = this.getField("Date1").value;

    Send var = this.getField("Date2").value;

    process if we have data

    If (sStart! = "" & send!) = "") {}

    convert date objects date strings

    var start = util.scand ("mmm yyyy", sStart);

    oEnd var = util.scand ("mmm yyyy", sending);

    get the full date and month year beginning

    var nStartFullYear = oStart.getFullYear ();

    var nStartMonth = oStart.getMonth ();

    convert data from start of month

    var nStartMonths = (nStartFullYear * 12) + nStartMonth;

    Get the complete year end date and month

    var nEndFullYear = oEnd.getFullYear ();

    var nEndMonth = oEnd.getMonth ();

    convert data from end of month

    var nEndMonths = (nEndFullYear * 12) + nEndMonth;

    do the math

    Event.Value = nEndMonths - nStartMonths;

    } / / end have given

    You will need to adjust the names for the start and end dates.

  • Is there a way to create a segment based on a blank Date field filter?

    We are working to build a program in Eloqua for updating Source of lead of a salesforce.com record IF the creation Date of lead is empty (among other conditions). Currently, if I've set up this filter in my segment, Eloqua says its an error because you cannot currently use the "If empty" option for a date field. Does anyone know a workaround for this?

    Yes there is! In program generator you want to create a rule of decision to examine the field in question. In this case, you will consider whether or not the given field has a value or not. The Yes path, (those you want to do something with) you would simply send them to a step to remove the program (or any other way you want to make them) and no path - which means that "no, the contact doesn't have a value for this field" then you send them on their way to update. See attached screenshot. I hope that's what you're looking for!

  • How can I automatically populate the date field after only one "digitally signs" a .pdf form? Help, please! Thank you!

    How can I automatically populate the date field after only one "digitally signs" a .pdf form? Here's a sample:

    _ Digital Signature___ (signs), Date (Auto-remplit)

    Under field properties of the signature on the signature tab, you can use a custom script, like this:

    this.getField("Date").value = util.printd ("mm/dd/yyyy", new Date());

    You know, however, that a digital signature always displays the date and time, it has been applied?

  • How to create a date field that is fixed at the signing?

    Hello

    I created a series of PDF forms on Adobe Pro XI which are designed to be filled out using Adobe Reader (where are saved as Adobe Reader Extended). Once the form is complete there are fields of signature that the user who digitally sign then it disables the specific form fields of editing more far. Next to the signature field, I have a date field that, at present, is using JavaScript to automatically generate the date of business at the opening. However, the question that I have is that I want this field date which will be fixed when the form is signed, rather than update again when the form is opened. Is this possible?

    The document JavaScript that I use to generate the date currently is:

    this.getField("Date1").value = util.printd ("dd/mmm/yyyy", new Date());

    But obviously, this is independent of the signature field.

    How can I create a date field which is set by the current date at the signing?

    I am very new to Adobe in general so I don't have much of an idea about how to go about doing this. Could someone please help me to do it if possible?

    Thank you

    KC

    Go to the properties of the field of Signature and on the signing tab, add

    Copy the following code in the section previous "this script is run when the field is signed.

  • Calculation of field date

    I have a form that the user enters a date of completion of a given field and I want to have this date + 45 days calculated in another area (expiration date). Any ideas on writing scripts for it?

    Place the following script in the event out of the full date field. The value of the FormCalclanguage.

    Duedate.rawValue = Num2Date (Date2Num (complete.rawValue, "YYYY-MM-DD") + 45, 'YYYY-MM-DD');

    Thank you

    Srini

  • Create table works, create materialized view only - long column names?

    Hello.

    I have no probs creating a table as well: -.
    CREATE TABLE blah
    (
    DEVICE_ID
    )
    in select
    "Device_ID" AS DEVICE_ID
    "of"sum" Device"@ed_link_3
    where "Device_ID" < 5;


    But when I try to create a materialized view:
    Blah1 CREATE MATERIALIZED VIEW
    (
    DEVICE_ID
    )
    < various materialized view parms >
    in select
    "Device_ID" AS DEVICE_ID
    "of"sum" Device"@ed_link_3
    where "Device_ID" < 5;

    It fails with errors: -.
    ORA-04052: error occurred when searching to the top of the remote object Aggregate.Device@ED_LINK_3
    ORA-01948: length of the name of the identifier (31) exceeds maximum (30)

    Is there a way to get around this?
    Is the problem with the columns of the remote table of device, which I do NOT need to import to have column names that are longer than 30 characters?

    For now, I want only the Device_ID column which is a simple 9 characters long.

    Oh, and the remote database is MySQL.
    I'm uncomfortable with the < parms of materialized view > as they work fine when I choose a different remote table with only short column names.

    Thank you.

    To my knowledge, you have the option
    (a) create view (with shortened column names or only with desired columns if they are already less than 30 char limit) side of mysql
    (b) use dbms_passthrough to force the analysis to be done on mysql (as in the example provided by SY here use dbms_passthrough to create a view )
    However, I prefer to stick to one), because with dbms_passtrhough, you retrieve row by row.

    Best regards

    Maxim

  • Displaying the time in the Date fields only when it is available

    Is it possible to display the component "hour" of a field of date only when the component "hour" is available? I know that the default behavior of not showing the component "hour" of the date fields can be changed by setting the date format NLS in the preferences to include the time as well. However, what causes the fields without component to appear with zeros. (For example: If nls date format is DD-MON-RRRR HH24:MI:SS, a date with no field component "time" will appear as * 1 January 2008 00:00:00 *). It is a configurable option in Quest SQL Navigator, with 3 options available, that says "(afficher l'heure dans les champs date: a) (never, (b) when available or c) always, who miss me dearly in SQL Developer."

    Thanks in advance for your suggestions,
    KLS.

    No, but you can vote on the feature to http://htmldb.oracle.com/pls/otn/f?p=42626:39:4403831115154402:NO:P39_ID:16221 request to add weight to implementations in a future version.

    Kind regards
    K.

  • TDMS file creates several tabs data. You want to create only one.

    Hello NOR community,

    I am currently using the DAQ Assistant with my pots of chain record travel over a long time interval (see annex VI). I then use the vi "Write to a file as" to save the data in a file TDMS (see 'Write the file settings' photo attached for all the parameters chosen for the writing of the file). The file is written, however when I open the PDM file, the document creates a tab in Excel for every second of recorded data (please see attachment ""). It seems that the TDMS file is grouping all data every second, and then by creating a new group of data.

    How can I get the file to write all data on a single tab instead of creating multiple? I don't want to concatenate hundreds of tabs in a single great sheet.

    Thank you

    Chris

    You should not use the comment.  I just removed who and everything worked for me.

  • Date field issue - before the previous dates only

    I would like a date field where the user must enter a date that is at least 1,095 days (3 years) before today's date.

    Yes, you dateToday variable does not need to have the Date2Num function, as I said, Date() returns the same value that Date2Num would be

  • Difference of field calculation date

    Hi all

    I am new to Adobe and Java script so apologies if this has already been answered elsewhere - I was not able to find it if it has.

    I want to calculate the difference between two date fields in hours and minutes on a form.

    I have two fields, the Date format (dd/mm/yyyy hh: mm), a start and end date and I want the difference between them at the time in the format hh: mm.

    Can someone help me with the script for this? What I have so far is:

    var strStart = this.getField("StartTime").value;

    var strEnd = this.getField("EndTime").value;

    if(strStart.Length || strEnd.Length)

    {

    var dateStart = util.scand ("mm/dd/yyyy hh: mm", strStart);

    var dateEnd = util.scand ("mm/dd/yyyy hh: mm", strEnd);

    diff var = dateEnd.getTime () - dateStart.getTime ();

    One day = (24 hours) x (60 minutes/hour) x

    (60 seconds/minute) x (1000 milliseconds per second)

    var oneMin = 60 * 60 * 1000;

    var minutes = Math.floor (diff/oneMin);

    Event.Value = util.printd("HH:MM",mins);

    }

    But it does not work...

    Mary

    Got it - Thanks for your help - really appreciate it.

Maybe you are looking for