tableau / extensions-api

Extensions API sample code and developer docs.
http://tableau.github.io/extensions-api
MIT License
268 stars 251 forks source link

Can't set marks by value on date field #148

Closed jhegele closed 5 years ago

jhegele commented 6 years ago

I have a column that looks like this:

{
    dataType: "date",
    fieldName: "ATTR(Date)",
    index: 4,
    isReferenced: true
}

I've been trying to set marks using this column in an extension with no success. I may have missed this but dealing with dates doesn't seem to be explicitly documented anywhere so I fumbled around and hit on an approach that (at a minimum) doesn't throw an error. I'd like to set marks across a range of dates so I'm using this code:

let selectionCriteria = [{
    fieldName: "ATTR(Date)",
    value: {
        min: "2016-02-10",
        max: "2016-03-11"
    }
}];
sheet.selectMarksByValueAsync(selectionCriteria, tableau.SelectionUpdateType.Replace).then(() => {
    console.log('Marks Set!');
})

This executes successfully in that it throws no errors and I see "Marks Set" in the console. However, no marks are actually set on the sheet. I've also tried building an array of all dates between the min and max with no luck.

If I've missed something or am going about this the wrong way, let me know and I'll close this out. But, at this point, I'm assuming there is some issue with the way the API handles mark selection using dates.

KeshiaRose commented 5 years ago

Hi John, are you still seeing this? Your syntax looks correct and it works from my testing. Let me know and I'll re-open this.

This issue does point to a different problem though, in that we want you to be able to pass dates like you would for other methods and not strings.