[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Converting DateNum() to a string...



PureBytes Links

Trading Reference Links

Jitu
I'm no help with regards to scripting but I do have an AFL that 
exports a file to Excel that has a unique date str attached. It may 
help. I've included the Function and the relevant part of the AFL.
  
////////////////////////////////////////////////////////////////////
// YYYYMMDD( indexofbar) returns date in YYYYMMDD str format      //
////////////////////////////////////////////////////////////////////
function YYYYMMDD( indexofBar )
	{
	tYear	= Year();
   tDate   = DateNum();
	Daystr = StrRight(WriteVal(tdate[indexofBar],1.0),2);
	Monthstr = StrLeft(StrRight(WriteVal(tdate[indexofBar]
*10,1.0),6),2);
	Yearstr = StrLeft(WriteVal(tYear[indexofBar],1.0),1)+StrRight
(WriteVal(tYear[indexofBar],1.0),3); 
	result = YearStr + Monthstr + DayStr;
	return result;
	}
////////////////////////////////////////////////////////////////

ReportExport =	"C:/Documents and Settings/Owner/My 
Documents/Investment docs/ROR System daily 
Scans/ROR_Report_"+YYYYMMDD(finishbar)+".TXT";
xxTableExport(ReportExport,"	",Report);

Hope this helps
Andrew

--- In amibroker@xxxxxxxxxxxxxxx, "jtelang" <jtelang@xxxx> wrote:
> I'm trying to use the number returned by DateNum() in a string 
> that'll designate a unique filename for each day, and for some 
reason 
> am unable to use the value returned. Here's a simplified example, 
> when trying to set it as a string to title. Does anyone know why 
this 
> wouldn't work? I get a syntax error on this -
> 
> EnableScript("vbscript");
> dn = DateNum();
> <%
>  AFL("Title") = CStr(AFL("dn"))
> %>
> 
> Following does work -
> 
> EnableScript("vbscript");
> dn = 9999999;
> <%
>  AFL("Title") = CStr(AFL("dn"))
> %>
> 
> What's the difference in assigning a constant vs a value returned 
by 
> DateNum to variable dn? FWIW, I tried ABTool's xxToString() 
function 
> as well. Similar problem...
> 
> TIA,
> 
> Jitu


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/