Copyright 2007, Information Builders. Slide 1 Dates and Functions Noreen Redden Information Builders, Inc.

Slides:



Advertisements
Similar presentations
ASP Date and Time Function List It's important to test that your data is valid before you work with it. These variable testing functions do the trick!
Advertisements

Server-Side Scripting with JSP (2) ISYS 350. Post Back A postback is call to the same page that the form is on. In other words, the contents of the form.
1 That’s Not a Date-Time Datatype, Is It? Renee Teatro Information Builders Information Builders Summit 2006 User Conference April 2006.
1 Noreen Redden FOCUS Users of New England 2012 MFD_PROFILE PROFILE for Your Synonym:
Relational Efficiencies Renee Teatro June Relational Efficiencies Agenda  Optimization Overview  JOIN Scenarios  Sort Scenarios  Aggregation.
Copyright  Oracle Corporation, All rights reserved. 2 Single-Row Functions.
Objectives After completing this lesson, you should be able to do the following: Describe various types of conversion functions that are available in.
Copyright © 2007, Oracle. All rights reserved Using Single-Row Functions to Customize Output Modified: October 21, 2014.
McGyver for Dynamic Subtotals/Subfoots Presented by David Smith of Brinker International.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Copyright 2007, Information Builders. Slide 1 Non-Relational Efficiencies Walter F. Blood Technical Director Information Builders, Inc.
UNITS OF TIME.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Word Processing Chapter 5 Review Slides. All template files have this file extension and are stored in the Templates folder.dotx.
Cupertino, CA, USA / September, 2000First ICU DeveloperWorkshop1 Date/Time/Number Formatting Alan Liu Globalization Center of Competency IBM Emerging Technology.
Template v4 September 27, Copyright © Infor. All Rights Reserved. 1 Time Track Payroll Schedule Configuration Development Team.
Introduction ABAP Dates. Slide 2 Lecture Overview I go into more depth than your book about how currency and quantity values work.
XP Copyright 2003 Peter McDevitt 1 Microsoft Excel 2002 Lecture 2 – Working With Formulas and Functions.
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
1 Team Leader TKS Job Aid. 2 Viewing the On-line Presentation If you are viewing this presentation via Internet Explorer for best results resize the “Notes”
Chapter 10 Working with Dates & Times Microsoft Excel 2003.
Noreen Redden FOCUS Users of New England 2012 FOCWizards and Focal Point Information Builders Off to See the Wizards 1.
Lesson 1: Introduction to ABAP OBJECTS Todd A. Boyle, Ph.D. St. Francis Xavier University.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Includes and Dates.
Said Salomon Unitrin Direct Insurance T-SQL Date and Time Functions Said Salomon.
U:/msu/course/cse/103 Day 10, Slide 1 CSE 103 Students: Your BTs have been graded. See Erica or Jo with questions or stay.
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Exploring Microsoft Access 2003 Chapter 2 Tables and Forms: Design, Properties, Views, and Wizards.
.EVAL & Y2K George Chin Wells Fargo & Company NorCal FUSE - June 11, 1999.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
Chapter 14 Internationalization F Processing Date and Time –Locale –Date –TimeZone –Calendar and GregorianCalendar –DateFormat and SimpleDateFormat F Formatting.
After completing this lesson, you should be able to do the following: Describe various types of functions available in MySQL Use character, number, and.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
CHAPTER 6 GROSS EARNINGS. IDENTIFY TERMS Compensation Salary, wage, pay or benefits received for the performance of service Double Time Twice an employee’s.
Cohesion and Coupling CS 4311
Chapter 3 Assignment, Formatting, and Interactive Input C++ for Engineers and Scientists Third Edition.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 9: Linux Network Services Chapter 16: Administration Tasks By Fred R. McClurg Linux Operating.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 11 Committed to Shaping the Next Generation of IT Experts. Chapter 3: Customize, Analyze,
Chapter 3: Assignment, Formatting, and Interactive Input.
C++ for Engineers and Scientists Second Edition Chapter 3 Assignment, Formatting, and Interactive Input.
Chapter 14 Internationalization F Processing Date and Time –Locale –Date –TimeZone –Calendar and GregorianCalendar –DateFormat and SimpleDateFormat F Formatting.
Conversion Functions.
Copyright 2007, Information Builders. Slide 1 What's New With Dates Renee Teatro Information Builders FUN Conference October 2009.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
Measuring Elapsed Time. Units of Time 1 minute (min) = 60 seconds (s) 1 hour (h) = 60 minutes 1 day = 24 h 1 week (wk) = 7 days 1 year is about 365 days.
Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc.
Teaching Time. This evening we will be… showing how maths strategies develop across the year groups show you the school’s calculations policy and how.
When the program is first started a wizard will start to setup your Lemming App. Enter your company name and owner in the fields designated “Company Name”
Chapter 3 Assignment, Formatting, and Interactive Input C++ for Engineers and Scientists Third Edition.
5 Copyright © 2004, Oracle. All rights reserved. Managing Data in Different Time Zones.
 May be times when we need calculations in a report. ◦ Total of how much a salesman has sold ◦ Report showing total inservice training hours an employee.
When the program is first started a wizard will start to setup your Lemming App. Enter your company name and owner in the fields designated “Company Name”
Copyright 2007, Information Builders. Slide 1 TABLE FILE: The Basics Noreen Redden FOCWizard June, 2008.
Working with Date and Time ISYS 475. How PHP processes date and time? Traditional way: – Timestamp Newer and object oriented way: – DateTime class.
Week 1 Lecture 1 Slide 1 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Visual Basic Programming 2 v Week.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
CONFIDENTIAL1 Good Afternoon! Today we will be learning about Calendar and Years Let’s warm up : Complete the conversion tables: Hours478 Minutes 1) Calculate.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
ASP Mr. Baha & Dr.Husam Osta  What is ASP?  Internet Information Services  How Does ASP Differ from HTML?  What can ASP do for you?  ASP Basic.
14 Shipping Time App Using Dates and Timers
Calculated Fields Exercises Queries
The Selection Structure
Time Revision.
Medical Dosage Calculations A Dimensional Analysis Approach
Web Systems Development (CSC-215)
Date Functions Farrokh Alemi, Ph.D.
HTML Forms What are clients? What are servers?
Do you have the time to review?
Overview of HEC Data Storage System (HEC DSS)
Presentation transcript:

Copyright 2007, Information Builders. Slide 1 Dates and Functions Noreen Redden Information Builders, Inc

Copyright 2007, Information Builders. Slide 2 Types of Dates Traditional Dates  Traditional Dates  A6YMD, I8YYMD, A6MYY, I4MTYY  Component Declaration for Editing only  No Validation  Default in Dialogue Manager  Date Components  I2Y, I4YY, Y or YY are just integers  MT is a 2 digit integer with value from 1 to 12  D is a 2 digit integer with value from 1 to 31.

Copyright 2007, Information Builders. Slide 3 Functions and Traditional Dates  Select Components -SET &MONTH = EDIT(&YYMD, ’$$$$99’);  Change Order of Components -SET &DTMDY = EDIT(&YYMD, '$$$$99$$') | - EDIT(&YYMD, '$$$$$$99') | - EDIT(&YYMD, '$$99') ; -TYPE DTMDY IS &DTMDY -SET &DTMDY2 = CHGDAT('YYMD', 'MDYY',&YYMD, - 'A8MDYY'); -SET &DTMDY3 = &MDYY ;

Copyright 2007, Information Builders. Slide 4 Types of Dates  “Smart Dates”  MYY, YYMD, MTrDYY,  Displacement from Base Date  FOCUS displacement from 12/31/1900 (day component) or 01/1901 (month/year only)  Also supports W (day of week) Q (Quarter)  DEFCENT and YRTHRESH  Convert from Traditional Date to/from Smart Date  DEFINE/COMPUTE or ACTUAL to USAGE datefield/dateformat = traddate; traddate/A8YYMD = datefield;  Use DATECVT

Copyright 2007, Information Builders. Slide 5 Functions and Smart Dates  Select Components, Change order of Components, Convert from Traditional to/from Smart Date DATECVT(date, 'infmt', 'outfmt'[, outfield]) DEFINE FILE EMPLOYEE HIRE_DATE/YYM DEFCENT 19 YRTHRESH 50 = DATECVT(HIRE_DATE,’I6YMD’,’YYM’); END -SET &DT2 = DATECVT (100101,'I6YMD','YYM'); -SET &DT3 = DATECVT (&DT2, 'YYM', 'I8YYMD');  Subtract two Dates DATEDIF (from_date, to_date, component_code) DEFINE FILE SUPPORT DAYS/I5 = END_DT – START_DT; WORK_DAYS/I5 = DATEDIF (END_DT,START_DT,’WD’);

Copyright 2007, Information Builders. Slide 6 Functions and Smart Dates  Add/Subtract Days/Months DATEADD(date, 'unit', #units[, outfield]) Function adds a unit to or subtracts a unit from a date format DEFINE FILE EMPLOYEE HIRE_SMT/YYMD DEFCENT 19 YRTHRESH 50 = DATECVT(HIRE_DATE,'I6YMD','YYMD'); HIRE_WK/YYMD = HIRE_SMT + 7; MONANN/YYMD = DATEADD(HIRE_SMT,'M', 6 ); END  Find Last Day of a Month DATEMOV(YYMDdate, 'move-point') -SET &DT2 =DATECVT((DATEMOV( - (DATECVT (&YYMD,'I8YYMD', - 'YYMD' )),'EOM')),'YYMD','I8YYMD');

Date Functions Argument ValueDefinition Yyear Mmonth DDay of month WD Working Day BDExcludes Holidays BOM/EOMBeginning/End of Month BOM/EOQBeginning/End of Quarter BOY/EOYBeginning/End of Year BOW/EOWBeginning/End of Week NWD/NBDNext Business/Week Day PWD/PBDPrior Business/Week Day WD+/BD+Move forward to get to week/business day if necessary WD-/BD-Move back to get to week/business day if necessary Arguments for Use With Date Functions

Copyright 2007, Information Builders. Slide 8 Types of Dates  Date-Time (time stamps)  HMDYYS – displays 02/27/ :00:05  HYYMDs – displays 2010/02/27 11:00:  HYYMDSA – displays 2010/02/27 11:00:05AM  Convert to Time Stamps HDTTM Convert from date field to date-time HINPUTConvert from alpha to date-time  Convert from Time Stamps HCNVRTConvert to alpha format HDATEConvert date portion to YYMD

Copyright 2007, Information Builders. Slide 9 Functions and Time Stamps  Select Components HPART – passed to relational engine in 7.7 HPART (value, component, outfield) IHOUR/I2 = HPART(JOB_TIME,'HOUR', IHOUR);  Subtract 2 timestamps HDIFF (end_timestamp, start_timestamp, component, outfield) DEFINE FILE JOBS DIFSEC/I9 = HDIF(ENDTM, STTM,'SECOND', 'D9.0'); END

Copyright 2007, Information Builders. Slide 10 Functions and Time Stamps  Incrementing Date-Time Fields HADD (timestamp, component, increment, length, outfield) DEFINE FILE JOBS NXTDUE/HYYMDS = HADD(ST_TIME), 'MONTH', 6, 8, 'HYYMDS'); END  Storing the Current Date/Time as a Time Stamp HGETC(length, outfield)

Date-Time Functions Component Name Valid Values year 0001 ‑ 9999 quarter 1 ‑ 4 month 1 ‑ 12 day ‑ of ‑ year 1 ‑ 366 day or day ‑ of ‑ month 1 ‑ 31 week 1 ‑ 53 weekday 1 ‑ 7 (Sunday ‑ Saturday) hour 0 ‑ 23 minute 0 ‑ 59 second 0 ‑ 59 millisecond 0 ‑ 999 microsecond 0 ‑ Arguments for Use With Date and Time Functions

Copyright 2007, Information Builders. Slide 12 Functions  Functions may be used against any field in any file, so long as proper arguments are supplied. Functions may be use anywhere an expression is allowed.  IBI-supplied functions may be augmented by user-written subroutines, called by FOCUS and coded in a 3GL language.  IBI-supplied functions may be augmented by user-written functions written in FOCUS language DEFINE FUNCTION name (argument1/format1,..., argumentn/formatn) [tempvariablea/formata = expressiona;]... [tempvariablex/formatx = expressionx;] name/format = [result_expression]; END

FOCUS Functions WORKWEEK DEFINE FUNCTION WORKWEEK (INPTDT/I8) DT1/YYMD = DATECVT(INPTDT, 'I8YYMD', 'YYMD'); DTTIME/HYYMDIA = HDTTM(DT1, 8, 'HYYMDIA'); WORKWEEK/I2 = HPART(DTTIME, 'WEEK', 'I2'); END -SET &WORKWEEK = WORKWEEK(&YYMD ); -RUN DEFINE FILE EMPLOYEE INPTDT/I8YYMD DEFCENT 19 YRTHRESH 50 = DATECVT(HIRE_DATE, 'I6YMD', 'I8YYMD'); WORKWEEK/I2 = WORKWEEK(INPTDT); END

Work Week PAGE 1 THE CURRENT DATE February 22, 2010 IS IN WORK WEEK 8 EMP_ID LAST_NAME HIRE_DATE WORKWEEK STEVENS 80/06/ SMITH 81/07/ JONES 82/05/ SMITH 82/01/ BANNING 82/08/ IRVING 82/01/ ROMANS 82/07/ MCCOY 81/07/ BLACKWOOD 82/04/ MCKNIGHT 82/02/ GREENSPAN 82/04/ CROSS 81/11/02 44

Handling Times AGENT1 AGENT_TALK AGENT_TALK1 TTIME TTIME1 ALLEN :03:20 00:05:00 BILL :05:00 00:06:40 CARL :10:20 00:08:40 DAN :06:40 00:15: TOTAL :25:20 00:35:21 We Need A Report That Reads Times In Seconds, Adds Them And Converts To Hours : Minutes : Seconds

FILEDEF AGNT DISK C:\IBI\APPS\DATES\AGNT.FTM FILEDEF FSEQ DISK C:\IBI\APPS\DATES\FSEQ.MAS DEFINE FUNCTION HRMISC (SEC/I10) -* CALCULATE HOURS HR/I2 = SEC/3600; HR_R/I2 = SEC -(HR* 3600) ; -* CALCULATE MIN MI/I2 = (HR_R / 60); -* CALCULATE SECONDS SC_D/I2 = SEC -((MI * 60) + HR); HRMISC/A8 = EDIT(HR) || ':' || EDIT(MI) || ':' || EDIT(SC_D) ; END DEFINE FILE AGNT TTIME/A8 = HRMISC(AGENT_TALK); TTIME1/A8 = HRMISC(AGENT_TALK1); END Handling Times

FILEDEF AGNT DISK C:\IBI\APPS\DATES\AGNT.FTM FILEDEF FSEQ DISK C:\IBI\APPS\DATES\FSEQ.MAS DEFINE FUNCTION HRMISC (SEC/I10) -* CALCULATE HOURS HR/I2 = SEC/3600; HR_R/I2 = SEC -(HR* 3600) ; -* CALCULATE MIN MI/I2 = (HR_R / 60); -* CALCULATE SECONDS SC_D/I2 = SEC -((MI * 60) + HR); HRMISC/A8 = EDIT(HR) || ':' || EDIT(MI) || ':' || EDIT(SC_D) ; END DEFINE FILE AGNT TTIME/A8 = HRMISC(AGENT_TALK); TTIME1/A8 = HRMISC(AGENT_TALK1); END Handling Times

TABLE FILE AGNT PRINT AGENT_TALK NOPRINT AGENT_TALK1 NOPRINT TTIME TTIME1 COMPUTE AVER1/I9 = (AGENT_TALK + AGENT_TALK1) / 2 +.5; NOPRINT COMPUTE AVERT/A8 = HRMISC(AVER1); AS 'AVERAGE' COMPUTE CNTAGENT/I5 = 1; NOPRINT BY AGENT ON TABLE RECAP TOTTIME/A8 = HRMISC(AGENT_TALK); TOTTIME1/A8 = HRMISC(AGENT_TALK1); TOTAVER/A8 = HRMISC((AGENT_TALK + AGENT_TALK1) /2); AVETIME/A8 = HRMISC(AGENT_TALK / CNTAGENT); AVETIME1/A8 = HRMISC(AGENT_TALK1 / CNTAGENT); AVEATIME/A8 = HRMISC((AGENT_TALK + AGENT_TALK1)/CNTAGENT/2); ON TABLE SUBFOOT "</1 TOTAL <TOTTIME <TOTTIME1 <TOTAVER " "AVERAGE <AVETIME <AVETIME1 <AVEATIME" END Handling Times

AGENT TTIME TTIME1 AVERAGE ALLEN 00:03:20 00:05:00 00:04:10 BILL 00:05:00 00:06:40 00:05:50 CARL 00:10:20 00:08:40 00:09:30 DAN 00:06:40 00:15:01 00:10:51 TOTAL 00:25:20 00:35:21 00:30:20 AVERAGE 00:06:20 00:08:50 00:07:35