Date as a value
Hey all -
Looking to see if anyone has been able to use the date as a value for calculating timed events.
Previous API application building using the AR System from Remedy for example, time started with 01/01/1900 as 1, and worked from there in seconds, so that timestamping events was a calculation based on seconds since that date.
I am still trying to figure out if there is a way to use a numeric representation for 'Today' when a users launches the application, and then based on whatever that value is add 60*60*24*14 + Today to set a date range.
For example:
<mx:DateChooser id="dateChooserMain" yearNavigationEnabled="true" width="175" height="145"
disabledRanges="{[ {rangeEnd: new Date(Today + 15days)} ]}" color="0x000000"/>
It seems like there should be some way for the SWF to see the system date/clock, and determine what value Today is, and then know to disable a range of available dates {<=(Today+1296000)}
Maybe it's just wishful thinking, but if anyone has been able to find a way to force the application to see a representation of Today in terms of Date, then I'd love to hear how you did that.
Cheers,
Rich
You can use the getTime() method to get the number of miliseconds that have elapsed since 1970. You can then perform whatever arithmetic operations you need and convert the value back to a date if needed.
var today:Date = new Date();
var todayMS:uint = today.getTime();
var oneDay:uint = 1000 * 60 * 60 * 24;
var yesterday:Date = new Date(todayMS - oneDay);
Chris
Similar Messages
-
Dynamic sql reurns no data when multiple values are passed.
(Dynamic sql returns no data when multiple values are passed.)
Hi,
While executing the below dynamic sql in the procedure no data is returned when it has multiple input values.
When the input is EMPID := '1'; the procedure works fine and returns data.Any suggestion why the procedure doen't works when input as EMPID := '1'',''2'; is passed as parameter?
=======================================================
create or replace PROCEDURE TEST(EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
stmt VARCHAR2(9272);
V_EMPID VARCHAR2(100);
BEGIN
V_EMPID :=EMPID;
stmt := 'select * from TEST123 where Empid is NOT NULL';
IF V_EMPID <> '-1' THEN
stmt := stmt || ' and Empid in (:1)';
ELSE
stmt := stmt || ' and -1 = :1';
END IF;
OPEN rc FOR stmt USING V_EMPID;
END Z_TEST;
============================================================
Script for create table
==================================================================
CREATE TABLE TEST123 (
EMPID VARCHAR2(10 BYTE),
DEPT NUMBER(3,0)
===========================================
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('1',20);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
=============================================
Select * from TEST123 where Empid in (1,2,3)
EMPID DEPT
1 20
2 10
3 30
3 30
2 10
===================================================================
Any suggestion why the procedure doen't works when input EMPID := '1'',''2';?
Thank you,The whole scenario is a little strange. When I tried to compile your procedure it couldn't compile, but I added the missing info and was able to get it compiled.
create or replace PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
stmt VARCHAR2 (9272);
V_EMPID VARCHAR2 (100);
BEGIN
V_EMPID := EMPID;
stmt := 'select * from TEST123 where Empid is NOT NULL';
IF V_EMPID = '-1' THEN
stmt := stmt || ' and Empid in (:1)';
ELSE
stmt := stmt || ' and -1 = :1';
END IF;
OPEN rc FOR stmt USING V_EMPID;
END;If you pass in 1 as a parameter, it is going to execute because the statement that it is building is:
select * from TEST123 where Empid is NOT NULL and -1 = 1Although the syntax is valid -1 will never equal 1 so you will never get any data.
If you pass in 1,2 as a parameter then it is basically building the following:
select * from TEST123 where Empid is NOT NULL and -1 = 1,2This will cause an invalid number because it is trying to check where -1 = 1,2
You could always change your code to:
PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
IS
stmt VARCHAR2 (9272);
V_EMPID VARCHAR2 (100);
BEGIN
V_EMPID := EMPID;
stmt := 'select * from TEST123 where Empid is NOT NULL';
stmt := stmt || ' and Empid in (:1)';
OPEN rc FOR stmt USING V_EMPID;
END;and forget the if v_empid = '-1' check. If you pass in a 1 it will work, if you pass in 1,2 is will work, but don't pass them in with any tick marks. -
Import Data in Multi Value Picklist
Hello,
Is there a way to import Data in Multi Values Picklist WITHOUT create the values MANUALLY before ?
Thank for your help.You need to manually create the values in a Multi Select picklist before doing your import.
-
MinList function is not working in Date or datetime values in DRM
Hi,
We have a custom property End Date with data type as Date. We want to calculate the minimum end date across all the children of a particular node.
While using the below function it is giving blank value as output.
MinList(ReplaceStr(ListNodePropValues(ListChildren(SortOrder),[comma],Custom.NO_ALL_ALL_ENDDATE),[comma],#,true),#,date)
If we remove the MinList part and only evaluate ReplaceStr(ListNodePropValues(ListChildren(SortOrder),[comma],Custom.NO_ALL_ALL_ENDDATE),[comma],#,true), we are getting an output like 12/31/2019#12/31/2018.
Why DRM is not able to extract the min value? Does DRM not support this kind of use of this function?
We have even tried with a date time property, but the result is same.
If by using the above mentioned method it is not possible to get the min date value, what alternative approach can be taken for achieving this?
Any help on this is much appreciated.
Thanks
SudiptaI found this useful, check if it helps,
Using MinList and MaxList with Date Or DateTime Values In DRM (Doc ID 1967005.1)
Hyperion Data Relationship Management - Version 11.1.2.3.000 and later
Information in this document applies to any platform.
GOAL
Example: How can we calculate the minimum end date across all the children of a particular node?
You have a custom property End Date with data type as Date. You have tried using MinList in conjunction with ListNodePropValues thus:
MinList(ReplaceStr(ListNodePropValues(ListChildren(SortOrder),[comma],Custom.EndDate),[comma],#,true),#,date)
This gives a blank value as output.
SOLUTION
The most robust way of doing this using formulas is to format the date property as a string in ISO 8601 format. In yyyy-mm-dd format, alphabetic order is also date order. Add a helper String property like this:
FormattedDate(Custom.EndDate),yyyy-mm-ddThh:mm:ss) -- omit the time from the 'T' on if desired. Note that the format string is case sensitive.
Then the MinList function
MinList(ReplaceStr(ListNodePropValues(ListChildren(SortOrder),[comma],Custom.Helper),[comma],#,true),#,string)
will work.
Note that the functions MinList and MaxList return a blank value if the list contains any members that are not of the specified data type. Using ReplaceStr will implicitly convert the dates into strings, causing MinList and MaxList to fail if you specify DateTime. -
Choosing a value based on newest date, and newest value
Good Afternoon,
I'm in search of help on a statement Im trying to perform in a Query transform in my ETL. So this is the scenario. I have a Value called SGSGVL which is "CYW" and in our descriptions table for the VALUE CYW we have 3 different Descriptions like Cadium Yellow, Cadium Yellow Paint and CDM Yellow and the date the description was added. What I would like to do is say:
Where in the description table = CYW, select the newest date and the most used value.
I've been told I can use a MAX statement but Im unsure exactly how to perform this in the query transform. Can anyone help? It would be GREATLY appreciated!
Thanks!You won't be able to do what you are asking in one query transform - it is complicated due the fact that you need your "max" to be based on something other than the column you want returned (date and count, versus the description). Essentially, what you need to do is:
QUERY1: value, description, field named REC_CNT with mapping of count(*), field named MAX_DATE with mapping of max(date), group by value and description
QUERY2: reads from QUERY1 --> value, field named MAX_REC which has a mapping such as: max(lpad(REC_CNT,'0',5) || '_' || to_char(date,'YYYYMMDD')), and group by value only
QUERY3: also reads from QUERY1 --> value, description, field named THIS_REC which has mapping such as: lpad(REC_CNT,'0',5) || '_' || to_char(date,'YYYYMMDD'), no group-by
QUERY4: joins QUERY2 and QUERY3 on QUERY2.MAX_REC = QUERY3.THIS_REC. Pull the value and description from QUERY3.
Basically - QUERY2 gives you the list of records which are considered the max, and QUERY3 gives you the full list with the same column to be able to join on, so QUERY4 pulls the descriptions only for the max record.
-Trevor -
Current date as default value in scaffolding
I added a datefield to scaffolding and I'd like to populate it with a default value set to current date. How can I do that?
Hello Ram,
We can not put current date as default value in Crystal Reports 2008.
If your prompt has calendar then current date will be highlighted once you click on calendar icon.
HTH.
Sumit -
Mandatory custom metadata field with current system date as default value.
I want to create a custom metadata field of type Date. I want to make it mandatory and want to set its default value as system date.
I have already created field of type Date. What expression I should write to make system date as default value?
Because its a mandatory field, what would happen to existing content. Will there metadata get updated?
Thanks
SanjeevI want to create a custom metadata field of type Date. I want to make it mandatory and want to set its default value as system date.
I have already created field of type Date. What expression I should write to make system date as default value?
See http://docs.oracle.com/cd/E23943_01/doc.1111/e10726/c08_config_ref.htm#CSIDO710
>
Because its a mandatory field, what would happen to existing content. Will there metadata get updated?No, it will not be updated - profiles are active only for new or updated items (in fact, they work on front-end).
>
Thanks
Sanjeev -
Mass data update in Value mapping table
Hi ,
I have used Value mapping replication to update the mass data from external source to Value mapping table . Its updatating in Runtime Cache but i want the data to be visible in GUI Value mapping table as well. Is it possible ? Because i doubt that the data in Runtime Cache may get removed if the system restarts . Can any one help ?
Thanks
LaksHi NALLAM GUNA RANJAN,
Thanks for your prompt reply but i didn't get what you are trying to convey . My issue here is
Instead of manually entering key-value pair in Value mapping table , I used Value mapping replication ( http://help.sap.com/saphelp_nw04/helpdata/en/2a/9d2891cc976549a9ad9f81e9b8db25/frameset.htm )
Its updating the data in Runtime Cache ( you can see this using Cache Monitoring ) but not able to view the data in Actual Value mapping Table (GUI in Directory of SAPXI) I want the data updated using Replication to be visible in GUI table is it possible ?
Hope you got the question much better now
Thanks
Laks -
Hi,
I want to find data type from its value.
Ex- If value = 1234 then its data type is numeric.
If value = ABCD then its data type is char.
So is there any FM which can tell the data type from its value or any way to do it.
Moderator Message: Offering points is against forum RoE.
Regards,
Ashish Gupta
Message was edited by: Suhas SahaHai.
check this.
the five non-numeric types (text field (C), numeric text field (N), date field (D), time field (T), and hexadecimal field (X)), there are three numeric types, used in ABAP to display and calculate numbers. Data type N is not a numeric type. Type N objects can only contain numeric characters (0...9), but are not represented internally as numbers. Typical type N fields are account numbers and zip codes.
integers - type I
The value range of type I numbers is -2*31 to 2*31-1 and includes only whole numbers. Non-integer results of arithmetic operations (e.g. fractions) are rounded, not truncated.
You can use type I data for counters, numbers of items, indexes, time periods, and so on.
Packed numbers - type P
Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
You can use type P data for such values as distances, weights, amounts of money, and so on.
Floating point numbers - type F
The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.
You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
C ---> character
D ---> date
P ---> packed
T ---> time
X ---> hexadecimal
I ---> integer.
N ---> Muneric.
Possible ABAP/4 data types:
C: Character.
D: Date, format YYYYMMDD.
F: Floating-point number in DOUBLE PRECISION (8 bytes).
I: Integer.
N: Numerical character string of arbitrary length.
P: Amount or counter field (packed; implementation depends on hardware platform).
S: Time stamp YYYYMMDDHHMMSS.
T: Time of day HHMMSS.
V: Character string of variable length, length is given in the first two bytes.
X: Hexadecimal (binary) storage.
regards.
sowjanya.b. -
Error occurs when updating grid Data Table - invalid value type [66000-150]
I am receiving the below error when using SetValue method of the Grid.DataTable object
Error No:-7768
Error Desc:Data Table - invalid value type [66000-150]
Any idea on why this error will ocurr
the data that I am trying to set is text and column data type is also text
sincerely yours
RayHi Ray,
I kind of faced a similar problem wherein, my functionalities work perfectly fine in the devt. environ but doesn't even reflects in the production environ. I kind of tried installing VS and removed it and things started working fine later.
Reason might be that some of the devt. components are missing in the production environ, other than .NET framework. If possible, you can try this.
Regards,
Satish. -
How to retrieve data from domain(Value Range) of the table
hi
how to retrieve data from domain(Value Range) of the table
thanksHello,
You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
BR,
Suhas
Edited by: Suhas Saha on Mar 24, 2009 10:08 AM -
Extract data from domain-value range
Hi,
I have a requirement to extract data from Domain-Value range.
I am using MDM generic extractor(mdmgx)
in 'Maintain ports and check tables' i can create a port but i should mention a table name.
I have a 'DOMAIN'
with a specific value range:
01 text1
02 text2
03 text3
so on...
i need to get these entries as a part of extracted data.
Could you please tell me how to do this?
Thanks a lot in advance.
Regards,
RashmiHey guys,
you're making things much to complicated. For extracting Domains with MDMGX, the TABLE NAME equals the DOMAIN NAME. Example for domain XFELD that is a common Yes/No Flag:
CLIENT 000
SYSTEM TYPE R3
OBJECT TYPE Vendor
MDM PORTCODE LT_YesNoIndicator
TABLE NAME XFELD
NONLANG FIELDS KEY=Key
LANG FIELDS LANGKEY=LANGKEY,VALUE=Name
WHERE CLAUSE
LINK INFO
FUNC XML
FUNC XSD
PROCESS LEVEL 0
TABLE NAME equals the domain name.
NONLANG FIELDS and LANG FIELDS use default entries as defined above.
If you check your system for "table" XFELD, you'll clearly see that it's a domain.
Cheers
Michael -
Q]DATA FNAME(60) VALUE 'myfile' . here do we create a new file or else?
Q] DATA FNAME(60) VALUE 'myfile' . here do we create a new file or refer to an existing file?
Talking of the OPEN DATASET statement.if u open a file for input purpose, then the file fname should be exist.
otherwise its for output, no need to be exist in the app.server
but u want append data to existed file, then its should be exist in app.server -
Parallel processing of mass data : sy-subrc value is not changed
Hi,
I have used the Parallel processing of mass data using the "Start New Task" . In my function module I am handling the exceptions and finally raise the application specific old exception to be handled in my main report program. Somehow the sy-subrc is not getting changed and always returns 0 even if the expection is raised.
Can anyone help me about the same.
Thanks & Regards,
NitinHi Silky,
I've build a block of code to explain this.
DATA: ls_edgar TYPE zedgar,
l_task(40).
DELETE FROM zedgar.
COMMIT WORK.
l_task = 'task1'.
ls_edgar-matnr = '123'.
ls_edgar-text = 'qwe'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
l_task = 'task2'.
ls_edgar-matnr = 'abc'.
ls_edgar-text = 'def'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
l_task = 'task3'.
ls_edgar-matnr = '456'.
ls_edgar-text = 'xyz'.
CALL FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' STARTING NEW TASK l_task PERFORMING f_go ON END OF TASK
EXPORTING
line = ls_edgar.
*& Form f_go
FORM f_go USING p_c TYPE ctype.
RECEIVE RESULTS FROM FUNCTION 'Z_EDGAR_COMMIT_ROLLBACK' EXCEPTIONS err = 2.
IF sy-subrc = 2.
*this won't affect the LUW of the received function
ROLLBACK WORK.
ELSE.
*this won't affect the LUW of the received function
COMMIT WORK.
ENDIF.
ENDFORM. "f_go
and the function is:
FUNCTION z_edgar_commit_rollback.
*"*"Interface local:
*" IMPORTING
*" VALUE(LINE) TYPE ZEDGAR
*" EXCEPTIONS
*" ERR
MODIFY zedgar FROM line.
IF line-matnr CP 'a*'.
*comment raise or rollback/commit to test
* RAISE err.
ROLLBACK WORK.
ELSE.
COMMIT WORK.
ENDIF.
ENDFUNCTION.
ok.
In your main program you have a Logical Unit of Work (LUW), witch consists of an application transaction and is associated with a database transaction. Once you start a new task, your creating an independent LUW, with it's own database transaction.
So if you do a commit or rollback in your function the effect is only on the records your processing in the function.
There is a way to capture the event when this LUW concludes in the main LUW. That is the PERFORMING whatever ON END OF TASK. In there you can get the result of the function but you cannot commit or rollback the LUW from the function since it already have implicitly happened at the conclusion of the funtion. You can test it by correctly comment the code I've supplied.
So, if you want to rollback the LUW of the function you better do it inside it.
I don't think it matches exactly your question, maybe it lead you on the right track. Give me more details if it doesn't.
Hope it helps,
Edgar -
Is there a way to name the .indd files created by a data merge with values in the CSV file
I have a data merge document that is set to single Record per Document page and 1 page per document. In my CSV file I have a field for Part Number. If I run a data merge with 10 records I end up with 10 .indd files. I need a way so that the resulting .indd files are named the same value that is in the Part Number field.
Loic has provided a link for my original piece, and I've written up some follow-up pieces for indesignsecrets.com:
http://indesignsecrets.com/data-merging-individual-records-separate-pdfs.php
http://indesignsecrets.com/data-merging-individual-records-separate-pdfs-part-2-scripting. php
So there are several ways to get unique name PDFs from an indesign Data Merge. However, none of these 3 articles will truly answer your question of how to get unique indesign filenames using the database. I can see a practical purpose for this as merging business cards directly to PDFs is great, but I can be guaranteed that while on proof, there will be alts to the business cards that need to be done outside the merge, meaning specific records need to be exported to indesign files for further manipulation.
Maybe you are looking for
-
What parameters should i give in Global Definition or in code
Hi all, the below program is the sample code,was done by my col...and we getting output correctly in se38...but the same if i give in smartform...its not coming out in the print/output form..... in global definition...i've given as itab like tline. i
-
How Can I connect the fingerprint reader to my form?
Hello all Is there an easy way to connect any fingerprint reader to my application and if yes please provide me the way and the name of the reader... Any help will be appreciated.
-
Differences line-out audio-out ?
Are there differences between using a SmartDeck by Griffin connected to the line-out or to the audio-out ? ciao alex
-
Disallow PGI Reversal of STO, If MIGO made against Outbound dly
Hello all, Please guide me in solving this query it is STO between 2 plants under same company code (1) STO Pur Order made for 100 Pcs (2) [vl10b & vl02n] - partial goods issue made i.e., for 50 Pcs (3) [MIGO]- Goods Receipt made with reference to th
-
Contents of egathcomp.html
Good day. I have a T60 and was wondering how to restore the contents of my egathcomp.html/xml files. Right now, my UUID, machine type and serial numbers are either blank or all 0's. Is there a way to restore the information? I already tried doing a c