Date and Time Data Extract Output Name

7160
23
10-11-2016 08:43 PM
AhmadSopian1
New Contributor

I would like to ask how to change the name of the resulting data extract into the current date and time??? thanks master..

outputFileName = (configXML.outputfilename[0] || "yyyy-MMM-dd-HHmmss") + ".zip";
outputFileName = outputFileName.replace(/(\\|\/|:|\?|"|<|>|\|)/g, "");‍‍
0 Kudos
23 Replies
DanPatterson_Retired
MVP Emeritus

it doesn't seem to replace dashes ... is that the issue or is getting the date time which you haven't show how you are getting??   In any event, once you have your date converted to a string use 'replace' to substitute the string elements    replace("-","")  yields 'YYYYMMMdd'

0 Kudos
AhmadSopian1
New Contributor

thanks you Patterson,,

i don't have date time string, can you help me for source data string date time for data extract arcgis flex?

0 Kudos
DanPatterson_Retired
MVP Emeritus

sorry... I thought it would return that format of date, my comment was on the replace segment... it won't replace dashes if that is the format that is returned

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ahmad,

   It would be something like this:

<mx:DateFormatter id="formatDate" formatString="YYYY-MMM-DD-LNNSS" />

outputFileName = (configXML.outputfilename[0] || formatDate.format(new Date)) + ".zip";
AhmadSopian1
New Contributor

Thanks Robert, you very helpful

0 Kudos
AhmadSopian1
New Contributor
Hello Mr. Robert,
Can u Help me..
Can add names format, if you choose shp format, will generate a name behind shp,,

outputFileName = (configXML.outputfilename[0] || formatDate.format(new Date)) + "format choose"+ ".zip";
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ahmad,

outputFileName = (configXML.outputfilename[0] || formatDate.format(new Date)) + formatDDL.selectedItem.data.substring(0, formatDDL.selectedItem.data.indexOf("-") - 1) + ".zip";

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

0 Kudos
AhmadSopian1
New Contributor

Sorry Mr. Robert,

i have not been able to find the solution of my problem to add the extension of the selected format.

from:

outputFileName = (configXML.outputfilename[0] || formatDate.format(new Date)) + formatDDL.selectedItem.data.substring(0, formatDDL.selectedItem.data.indexOf("-") - 1) + ".zip";
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ahmad,

   When you tested what did it give you?

If you want just the file extension then try:

outputFileName = (configXML.outputfilename[0] || formatDate.format(new Date)) + formatDDL.selectedItem.data.substring(format.lastIndexOf(".") + 1, formatDDL.selectedItem.data.length) + ".zip";
0 Kudos