ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  my $actualStartDate = [
Posted by seafree on Apr-01-2016 03:15
Hi Peter I'm using a GANTTCHART but I have a question about this variables:

my $startDate = [
my $endDate = [
my $actualStartDate = [
my $actualEndDate = [

What type variables are it?, the array declaration in perl is with @, so I don't understand declaration with $[, so could you tell me please, how can I view the variable content?

Thanks a lot.

  Re: my $actualStartDate = [
Posted by seafree on Apr-01-2016 04:18
Hi Peter about this, are reference arrays, now I have another question, how can I show the values from perl with print ?

my $startDate = [perlchartdir::chartTime(2004, 8, 16), perlchartdir::chartTime(2004,
    8, 30), perlchartdir::chartTime(2004, 9, 13), perlchartdir::chartTime(2004, 9, 20
    ), perlchartdir::chartTime(2004, 9, 27), perlchartdir::chartTime(2004, 10, 4),
    perlchartdir::chartTime(2004, 10, 25), perlchartdir::chartTime(2004, 11, 1),
    perlchartdir::chartTime(2004, 11, 8)];
my $endDate = [...........................]
my $actualStartDate = [.............................]
my $actualEndDate = [...............................]

I used the next sentence:

@{ $startDate };
print "$ { $startDate }[0]
";
print "$ { $startDate }[2]
";
print "$ { $startDate }[3]
";

But results are:
63228211200
63230630400
63231235200

How can I show the reference array $startDate values?

Tanks a lot.
Regards
seafree

  Re: my $actualStartDate = [
Posted by Peter Kwan on Apr-01-2016 20:25
Hi seafree,

The values you have printed (63228211200, 63230630400, ...) are already the $startDate values, so your code is already printing the correct $startDate values.

Even if you use just Perl (not ChartDirector) to create date/time, the values will be a number. For example, in the Perl code below, you will also get a number.

//Dec 11, 2015 10:30:00
$aaa = POSIX::mktime(0, 30, 10, 12, 11, 115);
print $aaa;

If you want to print back 2014-08-16, that means you want to format the $startDate value into a date, and not printing the actual value. You may use BaseChart.formatValue to format it to the date format you want:

print $myChart->formatValue(${$startDate}[0], "{value|mmm dd, yyyy}");

There is also a function perlchartdir::getChartYMD which can format the number into another 8 digit number representing yyyymmdd.

Hope this can help.

Regards
Peter Kwan

  Re: my $actualStartDate = [
Posted by seafree on Apr-02-2016 05:32
Hi Peter, you are wonderful.

Regards
Seafree