1 Reply Latest reply on Nov 16, 2017 8:55 AM by pchung RSS
    dsawyer Explorer

    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]); 
    }