Date function in XSL
Hi,
I am inserting XML data into database using XSL
XML File
<Employee_details>
<Emp_cd>E002</Emp_cd>
<Emp_name>Puneet</Emp_name>
<Emp_DOB>12-dec-90</Emp_DOB>
<Emp_Height>6.1</Emp_Height>
<Emp_address>Aundh</Emp_address>
<Emp_Desgn>TL</Emp_Desgn>
<Emp_Salary>370000</Emp_Salary>
<Emp_Dept>EDP</Emp_Dept>
<Emp_DOJ>12-mar-07 03:30</Emp_DOJ>
</Employee_details>
XLS File:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/Employee">
<ROWSET>
<xsl:for-each select="Employee_details">
<ROW>
<EMP_CD>
<xsl:value-of select="Emp_cd"/>
</EMP_CD>
<EMP_DESGN>
<xsl:value-of select="Emp_Desgn"/>
</EMP_DESGN>
<EMP_SALARY>
<xsl:value-of select="Emp_Salary"/>
</EMP_SALARY>
<EMP_DEPT>
<xsl:value-of select="Emp_Dept"/>
</EMP_DEPT>
<EMP_DOJ>
<xsl:value-of select="Emp_DOJ"/>
</EMP_DOJ>
</ROW>
</xsl:for-each>
</ROWSET>
</xsl:template>
</xsl:stylesheet>
i am sucessfully inserting date into table in format of dd-Mon-YYYY. but whenever i am trying to inserting the date in format dd-Mon-YYYY hh:mi its giving error like parsing xml file
i tried to change the date format in XSL like
<EMP_DOJ>
<xsl:value-of select="xs:dateTime(Emp_DOJ,''dd-Mon-YYYY hh:mi'')"/>
</EMP_DOJ>
but its not working as well,
whenever we have to insert the datetime value in table we have to use
to_date(emp_jod,'dd-Mon-YYYY hh:mi') but how it implement in XSL
Does this help?
SQL> CREATE TABLE emp_test (
2 emp_cd VARCHAR2(10),
3 emp_desgn VARCHAR2(30),
4 emp_salary NUMBER,
5 emp_dept VARCHAR2(3),
6 emp_doj DATE
7 );
Table created
SQL> DECLARE
2
3 xml_data xmltype :=
4 xmltype('<Employee_details>
5 <Emp_cd>E002</Emp_cd>
6 <Emp_name>Puneet</Emp_name>
7 <Emp_DOB>12-dec-90</Emp_DOB>
8 <Emp_Height>6.1</Emp_Height>
9 <Emp_address>Aundh</Emp_address>
10 <Emp_Desgn>TL</Emp_Desgn>
11 <Emp_Salary>370000</Emp_Salary>
12 <Emp_Dept>EDP</Emp_Dept>
13 <Emp_DOJ>12-mar-07 03:30</Emp_DOJ>
14 </Employee_details>');
15
16 xsl_data xmltype :=
17 xmltype('<?xml version="1.0"?>
18 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
19 <xsl:template match="/">
20 <ROWSET>
21 <xsl:for-each select="Employee_details">
22 <ROW>
23 <EMP_CD><xsl:value-of select="Emp_cd"/></EMP_CD>
24 <EMP_DESGN><xsl:value-of select="Emp_Desgn"/></EMP_DESGN>
25 <EMP_SALARY><xsl:value-of select="Emp_Salary"/></EMP_SALARY>
26 <EMP_DEPT><xsl:value-of select="Emp_Dept"/></EMP_DEPT>
27 <EMP_DOJ><xsl:value-of select="Emp_DOJ"/></EMP_DOJ>
28 </ROW>
29 </xsl:for-each>
30 </ROWSET>
31 </xsl:template>
32 </xsl:stylesheet>');
33
34 v_context DBMS_XMLStore.ctxType;
35 v_rows NUMBER;
36
37 BEGIN
38
39 -- change session nls to handle implicit conversion from date string :
40 execute immediate 'alter session set nls_date_format = ''dd-mon-rr hh24:mi''';
41
42 v_context := DBMS_XMLStore.newContext('EMP_TEST');
43 v_rows := DBMS_XMLStore.insertXML(v_context, xml_data.transform(xsl_data));
44 DBMS_XMLStore.closeContext(v_context);
45
46 END;
47 /
PL/SQL procedure successfully completed
SQL> select * from emp_test;
EMP_CD EMP_DESGN EMP_SALARY EMP EMP_DOJ
E002 TL 370000 EDP 12/03/2007 03:30:00If it's important for you, you may store the previous nls setting and reset it after loading.
Erm... wait... It won't work if you try to load "emp_DOB" in the same time.
I guess you'll have to ensure that all date strings come with the same format.
You can do that in the XSL :
<EMP_DOB><xsl:value-of select="concat(Emp_DOB,'' 00:00'')"/></EMP_DOB>Edited by: odie_63 on 30 juil. 2010 11:52
Edited by: odie_63 on 30 juil. 2010 12:00
Similar Messages
-
Using document function in xsl template - not working in BI Publisher
Hi,
I have a requirement where I need to display the data in one xml file based on the contents of a second xml. I am using Oracle BI Publisher 10.1.3.4.1 and template used for report generation is xsl-fo.
1) ReportData.xml - contains the data xml
2) ReportFilter.xml - contains the display information.
I need to display the tags in the ReportData.xml based on the presence , absence of different tags in ReportFiler.xml
I guess one of the option is to declare 2 datasource as use concatenated datasources. However , I am trying to use the "Document" function that is available in xsl transformation to reference the display xml.
I have tried the different options for using the document function
*1) <xsl:variable name="filterCheck" select="document('ReportFilter.xml')"/>*
Errors out saying : XML-22021: (Error) Error parsing external document: 'Access not allowed : file:/
C:/OracleBI/oc4j_bi/bin/ReportFilter.xml '.
*2) <xsl:variable name="filterCheck" select="document('file:///C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying ; Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
*3) <xsl:variable name="filterCheck" select="document('C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying : Caused by: java.net.MalformedURLException: unknown protocol: c
at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:153
*4)<xsl:variable name="filterCheck" select="document('file:/C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out syaying : Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
I have placed the document I need to access in all the 3 locations mentioned above
ie in my
*1) C folder*
*2) C:/OracleBI/oc4j_bi/bin*
*3) C:/OracleBI/xmlp/XMLP/DemoFiles*
Is there any special permissions that I need to grant to enable access to these files?
Please let me know if anyone has successfully made the document function to reference other xml documents in BI Publisher.
Regards
Sujith
Edited by: user10979469 on Dec 8, 2009 11:48 AMTim,
Thanks a lot for the reply. Set the option to enable external document access and it works perfectly.
Just for other who are looking at this post.
Go to the Report in BI Publisher
Click on Configure link on the top right
Go to the Section FO Processing
Disable external references - Server value is "True" . Set it to "False".
Apply changes.
Restarted the oc4j, just to be on safer side (not sure if this is required)
The document function will open documents from any location on your machine.
Thanks again Tim
Regards
Sujith -
How to use date functions in BPEL
Hi All,
Is there any wayout for calculating no. of years with a given date and current date in BPEL.
I am developing a small application where I have to calculate the years of experience of the employees. I am given with the date of joining.I want to subtract the date of joining from the current date. Is there any way-out to calculate no. of years from the given date and current date in BPEL using date functions or something else.
Please suggest something..
Thanks in Advance
Roshni Shankaryou could use something like this in xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml"/>
<xsl:variable name="date1" select="xs:date('2001-01-01')"/>
<xsl:variable name="date2" select="xs:date('2010-01-10')"/>
<xsl:variable name="dif" select="$date2 - $date1"/>
<xsl:template match="/">
<all>
<date1>
<xsl:value-of select="$date1"/>
</date1>
<date2>
<xsl:value-of select="$date2"/>
</date2>
<dif-days><xsl:value-of select="fn:days-from-duration($dif)"/></dif-days>
<dif-years1><xsl:value-of select="fn:years-from-duration($dif)"/></dif-years1> <!-- gives 0 for me -->
<dif-years2><xsl:value-of select="fn:days-from-duration($dif) div 356"/></dif-years2>
</all>
</xsl:template>
</xsl:stylesheet> -
Hi All,
I am trying to use date function in XSLT, I am using the below code, please correct me if i am wrong
<corecom:EffectiveDate>
<xsl:value-of select='xp20:format-dateTime(ns0:Segment-DTM/ns0:Element-373,"[YYYY][M01][D01]")'/>
</corecom:EffectiveDate>
Regards
FrancisHi Francis,
It doesn't seem to be anything wrong with the code itself, but what's the content of ns0:Segment-DTM/ns0:Element-373 ???
The xp20:format-dateTime function will work if the date on the first parameter is on ISO 8601 format...
http://www.w3.org/TR/NOTE-datetime
Examples
1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.
1994-11-05T13:15:30Z corresponds to the same instant.
Cheers,
Vlad -
Need milli seconds part in XSLT Date Function current-dateTime()
Hi All,
I am calling date function, current-dateTime() in XSL. The output format is 2012-04-05T16:38:01-07:00 (Without milli seconds)
How to get the milli seconds part...?
Regards,
SudheerHi Arik....
At last i got it. :)
Followed the below steps.
Step1:
Created a String variable "currentDateTimeValue" in BPEL.
Step2:
I have used the below code in JavaEmbedding in BPEL.
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat();
//Date Pattern looks lil weird. But some Web service accepts only this format.
sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'-00:00'");//2012-04-14T16:24:00.578-00:00
String formattedDate = sdf.format(new java.util.Date());
addAuditTrailEntry("Formatted datetime string is: " + formattedDate);
setVariableData("currentDateTimeValue", formattedDate);
Step3:
Created a Simple XSD with an element "DateElement" of String type.
Step4:
Assigned "currentDateTimeValue" value to "DateElement" element, in Assign activity.
Step5:
Now added this DateElement in Transformation activity, as a second source variable. Mapped this data to the required target element in my XSL.
uh-huh I got the output...
Thanks a ton ARIK :D u r really helpful...
Regards,
Sudheer -
Is it possible to use extension functions in the select attribute of xsl:sort? This way I could sort the nodes based on a computed value.
e.g. <xsl:sort select="myns:myextfunc(ELEM1, ELEM2)">
I tried using a standard XSL function like
<xsl:sort select="concat(ELEM1, ELEM2)"/> and it seems to work but when I try to use an extension function it fails.
TIA
nullWith XML Parser 9.0.1 Production, this works for me:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://www.oracle.com/XSL/Transform/java/Ext">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="/Employees/Emp">
<!--
| Due to a bug, need to declare the extension namespace on
| the <xsl:sort> element itself.
+-->
<xsl:sort data-type="number" order="descending" select="ext:max(Salary,Bonus)"
xmlns:ext="http://www.oracle.com/XSL/Transform/java/Ext"/>
<xsl:value-of select="Name"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
public class Ext
public static double max( double n, double m ) {
return n > m ? n : m;
<Employees>
<Emp>
<Name>B</Name>
<Salary>10</Salary>
<Bonus>12</Bonus>
</Emp>
<Emp>
<Name>C</Name>
<Salary>25</Salary>
<Bonus>12</Bonus>
</Emp>
<Emp>
<Name>A</Name>
<Salary>10</Salary>
<Bonus>2</Bonus>
</Emp>
</Employees>If I make sure Ext.class is in my CLASSPATH, and transform the above XML by the above stylesheet, I get:
CBA
which is the reverse-numerically-sorted list of max() calculations. -
Format-dateTime function in xsl
Hi,
I am trying to convert String format to specific date time format(YYYY-MM-DD HH24:MI:SS:FF).
I am using below function in xsl:
<xsl:value-of select='xpath20:format-dateTime(/ns0:Transmission/ns0:TransmissionBody/ns0:GLogXMLElement/ns0:ShipmentStatus/ns0:EventDt/ns0:GLogDate,"[Y0001][M01][D01][H01][m01][s01]")'/>
But it is not returning any value.
Source format is String(value= 20101020155400).
Target is dateTime(Expected Value= 2010-10-20 01:55:40.0).
Any suggestions will be helpful.
ThanksHi Arik....
At last i got it. :)
Followed the below steps.
Step1:
Created a String variable "currentDateTimeValue" in BPEL.
Step2:
I have used the below code in JavaEmbedding in BPEL.
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat();
//Date Pattern looks lil weird. But some Web service accepts only this format.
sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'-00:00'");//2012-04-14T16:24:00.578-00:00
String formattedDate = sdf.format(new java.util.Date());
addAuditTrailEntry("Formatted datetime string is: " + formattedDate);
setVariableData("currentDateTimeValue", formattedDate);
Step3:
Created a Simple XSD with an element "DateElement" of String type.
Step4:
Assigned "currentDateTimeValue" value to "DateElement" element, in Assign activity.
Step5:
Now added this DateElement in Transformation activity, as a second source variable. Mapped this data to the required target element in my XSL.
uh-huh I got the output...
Thanks a ton ARIK :D u r really helpful...
Regards,
Sudheer -
Data Federator Universe Date Functions
Hi,
I created a Data Federator Universe from target tables (Source Tables from: Sql Server 2005 and Oracle 10g). Now, I want to create a object in the universe: "Days between 2 dates"(coming from 2 different target tables). I don't see any other date functions other than CURDATE(). How to create my object?
Alternatively, Can I create a caliculated column in the existing target table? For Example, I want to create a new column "Days between 2 Dates" from 2 different tables by using a formula in Default mapping of the target table.
Thanks & Regards,
PeterHi Amit,
Thanks for your reply.
Ok. So, Universe on top of Data Federator has limited functionality.
And, other option you mentioned is on report level. I am creating an adhoc universe and I have few objects which will calculate days between 2 dates coming from 2 different tables.
But, how can I achieve this on Data Federator level. I have no function there to find Days Between 2 dates. I see lot of time and date functions but not the one I required. Also, I added a column in the target table and tried to apply the formula there in the default mapping area. But, I see only the selected target table. I need another date column from another table, which is not displayed in the default mapping area.
How can I achieve this?
Regards,
-Peter -
Print a DayName without using Date functions
Hi,
I have an assignment like without using any date functions i should print a calendar.
Below is the code without using any datefunctions like dateadd, datediff, datename a calendar has been generated for month and year entered. I want a week name for the dates like sunday ... monday etc.
I can take any date from calendar as reference and calculate based on that date.
ex: today is 2/20/2014 thursday . Next 7days again will be thursday, same way before 7days will be thursday.
I need to loop in below procedure and get weekname.
Plz help in the code,
I am using SQL server 2008
IF OBJECT_ID ('dbo.Calendar1') IS NOT NULL
DROP PROCEDURE dbo.Calendar1
GO
CREATE PROCEDURE [dbo].Calendar1 --4,1991
@month int,
@Year int
AS
BEGIN
declare
@startdateofMonthYear date,
@EnddateofMonthYear Date
Set @startdateofMonthYear=(Select cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'01')
Set @EnddateofMonthYear = (SELECT case when @month IN (1,3,5,7,8,10,12) then cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'31'
when @month IN(4,6,9,11) then cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'30'
else cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+(CASE WHEN (@YEAR % 4 = 0 AND @YEAR % 100 <> 0) OR @YEAR % 400 = 0 THEN '29' else '28' End)
End)
;WITH CTE_DatesTable
AS
Select 1 daysint, Cast(SUBSTRING(cast(@startdateofMonthYear as varchar(20)),1,7) + '-'+CAST(1 as varchar(2)) as DATE) Calendardates
UNION ALL
SELECT daysint+1,Cast(SUBSTRING(cast(@startdateofMonthYear as varchar(20)),1,7) + '-'+CAST(daysint+1 as varchar(2)) as DATE) Calendardates
FROM CTE_DatesTable
WHERE daysint<=
(SELECT case when @month IN (1,3,5,7,8,10,12) then 31
when @month IN(4,6,9,11) then 30
else (CASE WHEN (@YEAR % 4 = 0 AND @YEAR % 100 <> 0) OR @YEAR % 400 = 0 THEN 29 else 28 End)
End)-1
Select
[DWDateKey]=Calendardates,
[DayDate]=daysint,
[MonthNumber]=@Month,
[MonthName]=Case when @month = 1 then 'January'
when @month = 2 then 'February'
when @month = 3 then 'March'
when @month = 4 then 'April'
when @month = 5 then 'May'
when @month = 6 then 'June'
when @month = 7 then 'July'
when @month = 8 then 'August'
when @month = 9 then 'September'
when @month = 10 then 'October'
when @month = 11 then 'November'
when @month = 12 then 'December'
End,
[Year]=@Year
From CTE_DatesTable
END
bhavanaIn the above code, where do i pass the year and month?
(Select 2000 YearID
Union All
Select YearID +1 From cte where YearID <2100
In above condition from 2000 year its displaying.
If i want in 90's year , Day name will not be correct.
Deepa -
Date function doesn't work in Message Subject when scheduling batch
Hi,
When I was scheduling a batch and went to PDF attached E-Mail panel, in the Message Subject line I added a function <<Date(yyyy-MM-dd)>>,but when the email was sent, the date function in the subject didn't show the actual date, just showed the original function text <<Date(yyyy-MM-dd)>>, Is there anyone can help on this? Thanks in advance.Hi,
Can I know the Hyperion Version you referring ?
regards,
Harish. -
I have recently written my first stored procedure.
Its rather a bunch of SQL statements.
I had to hard code lot of dates. most of them are first day of the current monthe or last day of current month etc.
I thot of parametrizing all the dates, but if a business person has to include all the parameters they could go wrong and get the wrong results.
Now, I want to use date functions to achieve these requirements:
Can any one please throw some insght into this:....
1) First day of current month,
2) last day of current month.
3) first day of previious month
4) last day of previous month
5) first day of a month that is 3 months from now.
6) last day of a month that is 3 months from now.
7).....
Can any one please throw some light on any one of this.. I can try to work from there onwards ....
Thanks a lot in advance,
AcHi there,
1) First day of current month
select trunc(sysdate, 'MM') from dual;
2) last day of current month.
select trunc(add_months(sysdate, 1), 'MM') - 1 from dual;
3) first day of previious month
select trunc(add_months(sysdate, -1), 'MM') from dual;
4) last day of previous month
select trunc(sysdate, 'MM') - 1 from dual;
5) first day of a month that is 3 months from now.
select trunc(add_months(sysdate, 3), 'MM') from dual;
6) last day of a month that is 3 months from now.
select trunc(add_months(sysdate, 4), 'MM') - 1 from dual;cheers,
Anthony -
Problem overloading "set data" function on Button DataGrid Renderer
Hi all, I'm hoping this is something simple.
I have a class that extends mx.controls.Button and implements mx.core.IDataRenderer. I need to set the button icon whenever the Data property is set from the DataGrid. My problem is that my overloaded set/get Data function are never called (I've stepped through the code in debug). Instead the set/get functions in Container.as (Flex 3.4 SDK) get called.
Here's the basics code:
exportButtonRenderer.as
package controls
import flash.events.Event;
import flash.events.MouseEvent;
import mx.controls.Button;
import mx.core.IDataRenderer;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.events.FlexEvent;
import mx.controls.Alert;
import model.descriptors.compDescriptor;
import events.exportClickedEvent;
public class exportButtonRenderer extends Button implements IDataRenderer
// embed your icons
[Embed(source='/assets/icons/export.png')]
[Bindable]
public static var imageExport:Class;
[Embed(source='/assets/icons/blank.png')]
[Bindable]
public static var imageBlank:Class;
public function exportButtonRenderer()
super();
private var _listData:DataGridListData;
override public function get listData():BaseListData
return _listData;
override public function set listData(value:BaseListData):void
_listData = DataGridListData(value);
private var _data:Object;
override public function get data():Object
return _data;
override public function set data(value:Object):void
_data = value;
override protected function clickHandler(event:MouseEvent):void
super.clickHandler(event);
Now I know I'm using the Flexlib TreeGrid and not a standard DataGrid but when I trace through all the code all code firing the set/get functions is coming from the DataGrid anyway.
Here's the my Grid def in my main app mxml:
Header 1
<flexlib:TreeGrid
id="MKTXGrid"
dragEnabled="false" sortableColumns="false" showRoot="false"
disclosureClosedIcon="@Embed(source='/assets/icons/arrow_right.png')"
disclosureOpenIcon="@Embed(source='/assets/icons/arrow_down.png')"
folderOpenIcon="@Embed(source='/assets/icons/psd.png')"
folderClosedIcon="@Embed(source='/assets/icons/psd.png')"
click="MKTXGrid_clickHandler(event)"
doubleClickEnabled="true" doubleClick="MKTXGrid_doubleClickHandler(event)" left="0" right="0" top="0" bottom="16">
<flexlib:columns>
<flexlib:TreeGridColumn dataField="Name" headerText = "Name" minWidth="200" width="200" editable="true"/>
<mx:DataGridColumn dataField="ExportName" headerText = "Export Name"/>
<mx:DataGridColumn dataField="Export" headerText = "Export" width="50" minWidth="20" resizable="false">
<mx:itemRenderer>
<mx:Component>
<mx:Box horizontalAlign="center" width="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off">
<controls:exportButtonRenderer label="Export" icon="@Embed(source='assets/icons/export.png')" width="12" height="12" useHandCursor="true">
<controls:click>
<![CDATA[
import events.exportClickedEvent;
var e:exportClickedEvent = new exportClickedEvent();
e.itemData = data;
dispatchEvent(e);
]]>
</controls:click>
</controls:exportButtonRenderer>
</mx:Box>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</flexlib:columns>
</flexlib:TreeGrid>
Nothing too special going on.
I know this can be done, I've seen examples in the SDK:
http://opensource.adobe.com/svn/opensource/durango/trunk/ExternalFlexTools/com/dougmccune/ containers/accordionClasses/AccordionHeader.as
By the way I've stepped through the code of the TreeGridItemRenderer class in Flexlib which works correctly and the class def starts like this:
TreeGridItemRenderer.as
import flash.display.DisplayObject;
import flash.display.InteractiveObject;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flexlib.controls.TreeGrid;
import mx.controls.Image;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.controls.listClasses.IDropInListItemRenderer;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.IDataRenderer;
import mx.core.IFlexDisplayObject;
import mx.core.IToolTip;
import mx.core.SpriteAsset;
import mx.core.UIComponent;
import mx.core.UITextField;
import mx.events.FlexEvent;
import mx.events.ToolTipEvent;
import mx.events.TreeEvent;
import mx.managers.ILayoutManagerClient;
import mx.styles.IStyleClient;
public class TreeGridItemRenderer extends UIComponent
implements IDataRenderer,
IDropInListItemRenderer,
ILayoutManagerClient,
IListItemRenderer
Any help would be great!That's because you put your component in a Box. The DataGrid is setting the Box's .data property and no code is setting the one on your component. You shouldn't really need Box. You can override updateDisplayList to center your Button instead.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Help with Date function in sql query....
My question I guess is really 2...I'm trying to use the date function as a comparison in my WHERE clause in my sql command.
1. My date format is dd-MMM-yy eg. (01-Apr-06) ... my problem is the Apr is lower case where my field in the database is 01-APR-06 so when I compare 01-Apr-06 to 01-APR-06 is doesnt find any rows. Is there away that I can make the Apr all upper case so that it is APR.
2. My second problem is getting this "date" field to work in my sql stmt I keep getting errors and it works fine if I take my attempts at trying to compare the date.
--------------Date Code----------------------------------------------------------
<%!
String getFormattedDate(java.util.Date d)
SimpleDateFormat simpleDate = new SimpleDateFormat("01-MMM-yy");
return simpleDate.format(d);
%>
<%
java.util.Date d = new java.util.Date();
String dateString = getFormattedDate (d);
%>
---------------------------Sql statment------------------------------------------
ResultSet rset = stmt.executeQuery ("SELECT name " + " FROM table where rdate = '01-APR-06' order by name ");
Currently Im just hard coding the date but I need to make it so it uses the date code...so....
rdate should equal the date from the formatted date in upper case
something like
rdate = <%= dateString %>
Thanks in advance for any ideas anyone may have...There are sql functions upper & lower.
SELECT name FROM table where upper(rdate) = '01-APR-06' order by name Or you could convert the date to a string, and use the toUpperCase & toLowerCase java.lang.String methods. It doesn't make much of a difference--do you want the java compiler to do the string conversion or the database? -
How to use data function using characterstics variable for calculation on
how to use data function using characterstics variable for calculation on attribute as key figure
Hi Gayatri
Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
This essentially means, IF A = B THEN C ELSE D
The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
IF PART_NUMBER < 'SDK00' THEN pay_amount
ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
ELSE pay_amount + 100
This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
In English this can be read as follows:
IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
Best wishes
Michael -
DATE function to get name of day for a Date given?
hi guys,
can anyone tell me what is the DATE function to get the name of day for a date given
(12/dec/2004)---returns SUNDAYHi peter
Your Query will return an error.
SQL> select to_char(to_date('12/dec/2004', 'mm/mon/yyyy'), 'DAY')from dual;
select to_char(to_date('12/dec/2004', 'mm/mon/yyyy'), 'DAY')from dual
ERROR at line 1:
ORA-01816: month may only be specified once.
month is specified twice.
select to_char(to_date('12/dec/2004', 'dd/mon/yyyy'), 'DAY')from dual;
Regards
Sasidhar.P
Maybe you are looking for
-
Renaming ability + abilty to create custom album
Please please, i have always bought sony and i absolutely adore your touch in the apps you put to beautifully plate the stock android. What's missing in the album application is 1) the ability to create customized albums in which you'd put pictures o
-
Onrelease gotoandplay PLEASE HELP!
I am new to CS4 and actionscript 3.0. I am developing a flash website for a friend of mine as a favor. Ive been stuck with a small problem for a day and a half already. I am used to the oldschool flash MX 5.0 and actionscript 1.0 where you could simp
-
Aperture thinks a project has offline referenced masters - but it doesn't!
I've just been consolidating two Aperture libraries by exporting projects from one library and importing them into another. For the most part this has gone smoothly, but in one project all the images have the little badge with the red slash through i
-
Have Yosemite installed on both my MBA and Mac Pro. iPhoto 9.0 running well on the MBA but when I tried opening iPhoto on my Mac pro get the message "The library could not be opened because the file system of the library's volume is unsupported." Thi
-
It sounds like my iPod is in a tunnel, any ideas how to fix this?
My ipod touch sound has suddenly gone wonky. It echoes a bit like the sound is coming through a tunnel. I have no idea with to do, please help!