cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

show day from .getDay()

Darryl
12-Amethyst

show day from .getDay()

Hi All

Once again, there is probably a simple solution to this that I am missing.

I have written some code that outputs to an infotable, with a column being day. I use the infotable to populate a bar graph. I am looking to change the day column to display the actual day of the week instead of 0 - 6.

if (buckets[eventDay] == null) {

        buckets[eventDay] = new Object();

        buckets[eventDay].Date = eventDay;

        buckets[eventDay].Day = eventDay.getDay();

        buckets[eventDay].Min = 9999999;

        buckets[eventDay].Max = -1;

    }

  

    var bucket = buckets[eventDay];

if(eventAmount > bucket.Max) {

      bucket.Max = eventAmount;

}

if(eventAmount < bucket.Min) {

      bucket.Min = eventAmount;

}

// logger.warn("eventDay (" + eventDay + ") bucket max (" +bucket.Max+ ") bucket min (" +bucket.Min+ ")");

    bucket.Usage = bucket.Max - bucket.Min;

}

var params = {

infoTableName : "InfoTable",

dataShapeName : "eventAmountDS"

};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(eventAmountDS)

var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

var bucketIndex;

for(bucketIndex in buckets) {

//    logger.warn("bucketIndex (" + bucketIndex + ") bucket (" + buckets[bucketIndex] + ")");

//    logger.warn("min (" + buckets[bucketIndex].Min + ")");

//    logger.warn("max (" + buckets[bucketIndex].Max + ")");

   result.AddRow(buckets[bucketIndex]);

}

1 REPLY 1
PaiChung
22-Sapphire I
(To:Darryl)

Add a Select statement to take 0-6 and convert that to Sun-Sat?

Announcements


Top Tags