I have a flat file datasource that I'm using to construct a Dimension. One of the columns is a DateTime in the format: yyyy.MM.dd HH:MM, which I specified as the 'Date Converter Pattern'.
However, when I connect to my cube using an Excel Pivot Table, the date format defaults to: yyyy-MM-DDTHH:MM:ss.SSS and when I try to create a Timeline on my PivotTable, excel does not recognize this as a valid DateTime format.
is there any way to change this in the config files
thanks
To create a TimeLine Excel is using several DISCOVER requests and is more or less assuming it is talking to SSAS to discover an " attribute " hierarchy. Support has been added into icCube (from 6.0.1) to flag a hierarchy as an Excel TimeLine (new field in the hierarchy definition): this hierarchy must have an ALL level and a single DATE (i.e., days) level below.
I'm a bit lost, I understand you've converted to a DateTime the strings from the data source. Why do you see 'yyyy-MM-DDTHH:MM:ss.SSS' as the member names/labels ?
You can choose whatever you want to ?
My educated guess, Excel is taking for the timeline the key of the member not the label (that needs to be a DateTime object in the datasource).
Can you clarify ?
Related
I'm spinning my wheels right now and what I'm pretty sure is an easy answer, I just can't see at the moment. What I'm attempting to do take two sets of converted dates in a database and I want to present them in a grid view as one single date format.
Right now the two date formats are as follows:
YYYYMMDD
mon dd yyyy hh:miAM/PM
I want to convert them all into one format. For giggles, lets just convert them all to 112 (YYYYMMDD).
Now I want to present this all in the same SELECT statement that populates my gridview with other columns of data of various forms lots of text, data entry, long characters, etc.
The thing I haven't been able to wrap my head around is how to put this into a SELECT statement that includes all the rest of the information that populates the gridview.
So a normal SELECT statement (into all nvarchar(max) fields...the table is formed this way because we deal with lots of non standard data importing like Unix) would look like this (this is just a sample database):
SELECT [record_number], [price], [product], [description], [date_of_order], [customer_id] [comments]from sample_database
When presenting the 'date_of_order' field, I figured I need to use a CAST or CONVERT with the proper conversion numbers. However, after looking online I'm scratching my head on how to do this as most of the somewhat relevant information is focused around converting with the GETDATE option instead of leveraging the date that's already written to the database (the information is entered on a different part of the website).
I'm just looking for a pointer or a suggestion in the right direction to use a SELECT statement in my gridview (along with all of the other fields) that can convert any/all of the entries into one common date format. I know I'm missing something simple here but I don't know what.
I should note that I don't want to change them in the Database just when presenting them in the Gridview.
Use the following Convert SQL Function around all of the date fields you require, be warned that this can cause errors if the value is not a correctly formatted date.
CONVERT(datetime, [OldDate], 112)
Found here.
Also look here for more information on the Convert Function
I am using xdmp:document-filter(doc(uri)) to fetch the metadata from the documents. When I run this command on one of the documents I get the following result:-
xdmp:document-filter(doc("/Vision.doc"))//*:meta[#name eq "Creation_Date"]/#content
<?xml version="1.0" encoding="UTF-8"?>
<results warning="attribute node">
<warning warning="attributes cannot be root nodes" content="17-05-2012 00:48:00"/>
</results>
And when I run this command on another document then I get this:-
<?xml version="1.0" encoding="UTF-8"?>
<results warning="attribute node">
<warning warning="attributes cannot be root nodes" content="2012-06-03T13:45:00Z"/>
</results>
You can see that date format is different in both the outputs. There may be different date formats in documents uploaded in Marklogic Server. But I want to show the creation date of documents in some fixed format (e.g. May 16, 2012). How can I convert the different date formats to a fixed date format ? And also I want to compare these dates to the date entered by the user. The documents matching the search criteria should get returned by the search query. So I have two questions here:-
How to convert creation date of particular documents to some fixed format and to display it in the UI.
How to compare this creation date to the date entered by the user(which is in "mm/dd/yyyy" format) so that I can get the correct result.
You will have to parse the dateTime value. For example:
let $dt := "17-05-2012 00:48:00"
return
if ($dt castable as xs:dateTime)
then xs:dateTime($dt)
else xdmp:parse-dateTime("[Y01]-[M01]-[D01] [h01]:[m01]:[s01]", $dt)
This will return an xs:dateTime atomic value, which can be compared and displayed in the UI. If you want to support additional formats, you will need to create additional parse "picture" strings so they can also be converted to xs:dateTime. See the documentation on xdmp:parse-dateTime() for more information.
As a part of a larger open source project I cooked up a date parsing library that handles at least 20 different formats in 6 different languages. You can also supply your own formats if one is not already defined. It works by feeding it a date as a string in any of the defined formats and returning an xs:dateTime if it was able to successfully parse it. You can find the library here:
https://github.com/marklogic/Corona/blob/master/corona/lib/date-parser.xqy
To use it:
import module namespace dateparser="http://marklogic.com/dateparser" at "date-parser.xqy";
dateparser:parse($filteredDocument//*:meta[#name eq "Creation_Date"]/#content)
This will allow you to normalize the various date formats that binary documents can have. I will note that different binary formats (Word, PDF, JPEG, etc) will use different names for the creation date. So just looking for the "Creation_Date" metadata could leave some holes depending on what formats you're storing in MarkLogic.
Also note, that if you just want the date information without the time portion, you can cast the xs:dateTime to an xs:date. Doing so will retain the timezone information which is likely a good thing.
As for your second question…
There is a number of different ways to do this and reading some of the MarkLogic documentation is a good place to start. I'd recommend taking a look at:
http://docs.marklogic.com/guide/search-dev/rangequery
Hopefully that will shed a bit of light on what your query needs to look like. In simplest form you will probably have to first parse the date that the user provided. This can also be done with the date parsing library so users can enter tons of different date formats (eg: November 13th, 2012 or even in Spanish Noviembre 13th, 2012). Then use that parsed date to construct date range queries in MarkLogic.
If that doesn't help I'd post another question here with the specifics of where you're getting hung up.
I am working in C++ .net. I have a custom control that shows the contents of a dataBase with a bindingsource in between. I use labels in the control to bind the text property to the data in the dataset through a bindingsource with the following code:
mycontrol->Controls[i]->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text",
this->bindingSourceRelRev_Data, mycolumn,true, System::Windows::Forms::DataSourceUpdateMode::OnValidation,
nullptr, L"t")));
Please, note that the code is an excerpt of a loop that iterates on all the controls, therefore the control[i], which would be the label control, and the variable mycolumn, which would be the column of the dataset to be binded to. It works fine apart of an unwanted behaviour that I haven't yet found the way to change.
The sofware runs in different parts of the world but the records must be in local time. The database stores the time in localtime as a DateTime value but the dataBinding interprets it as UTC and shows the time in the label with the timezone difference applied. For example, if the data is 24/06/2012 16:40, it will show 24/06/2012 22:40 in a 4 hours difference time zone.
I need it to show just the value as it was stored, without changes.
I can think of different ways to go arround, but non elegant:
-capture the text update event of the label and un-do the change...
-Store the date as String in the DB...
-fill manually the labels...
-...
If I bind without formating, it will not change the value, but then I have the raw datetime string on the label...
Please, any magic I am missing in the binding so that it will not assume it has to change the time zone?
Thank you very much in advance!
Adan
well, it seems that the problem was not actually on the binding but in the dataset itself. The columns' property DateTimeMode was set as undefinedlocal and this was serializing the dataimput and converting it to the local time of the machine viewing the data. Just changed the property to undefined and it works now as I wanted, just taking the date from the data unmodified.
I was confused by the documentation on the format provider for DateTime, which states that it serializes the date. Perhaps I missunderstood it... It actually doesn't.
Thank you very much anyway!
I have been reading all about converting TEXT fields into date formats and ways to use Python to create date objects but my question remains.
My table has a dateTime column that is specified as TEXT, I would like to build a constraint that forces input to be in dateTime format, but as SQLite doesn't do dates (as I would like) I haven't worked out how to do it.
My current ideas: 1. Limit number of characters
2. Set separate attributes for day, month and year and constrain their domains
3. It is silly to do this on the database side just do it in the user interface
I would appreciate your opinions on these or other options.
Thanks :)
I've been trying to solve the same issue and the method I came up with was to use the date/time functions to parse the value and check that it hasn't changed. Essentially the following:
CREATE TABLE dts_test (
dts TEXT CHECK (dts IS datetime(dts))
);
If the default format is not what you want you can use the strftime or similar to design whatever format you want, but it must be something that the built-in date and time functions can parse.
I am facing an issue in my Flex application.
I am creating some array collections and storing date objects in it.In the later part of the application I will create 'advanceddatagridcolumns' with these array collections as the data sources.
Initially while creating the Array Col , I do have the 'formats' given by user, for each array collection eg. '1995/06/25' but in the later part I have no access to these formats. I want to display this dates in the data grid in same way as the user has specified. Right now, it displays it in the default format 'Sun Jun 25 00:00:00 GMT+0530 1995' instead of '1995/06/25'.
I have a common 'labelFunction' for these advancedatagridcolumns, and thus I can not use the DateFormatter as I 'formatstring' would be different for different columns.
So is there some way to display/retrieve the date in the same format as stored and not in the default way. Or while creating the date object can't I specify that I would always like it to be returned in some desired format.
The Date class in Flex as far, as my experiences go, is not very versatile. My hunch is that this is by no means possible with the regular framework capabilities.
However, if the date does not need to be changed after the user has input it, you might just want to save it as String and only create a temporary ArrayCollection of Dates for displaying them. This way you don't need to worry about the format changing because you're saving the original value.
How are you parsing the dates anyway? I mean that are you finding out the format yourself with RegExps or such, or using the parse method of the Date class?
just create a labelfunction specific to that column only and then you can use the formatstring