Configuring a DateTime SQLTag in TagProvider

In my SQLTagProvider I am configuring a tag of type DateTime. When I view my tag in the designer, instead of seeing the date value, I see #,##0.## which is the Format String that has been set for that tag. When I edit the tag and set the format string to yyyy-MM-dd h:mm:ss aa then my datetime appears properly for my tag.

When configuring the tag in my TagProvider, how can I set that format string so that my DateTime values appear properly?

Strangely, it appears that that may not currently be possible. I think there should probably be an overload of configureTag and/or configureTagType that takes a set of default tag properties for the tag. In that case, you could just include the desired format string.

However, we probably should also default to a format string appropriate for the type of the tag…

I’ll try to get these in to 7.3 soon.

Regards,

We found a way to make it work using a TagDiff:

TagDiff tagDiff = new TagDiff();
tagDiff.setAttribute(TagProp.FormatString, new BasicTagValue(“yyyy-MM-dd hh:mm:ss a”));

TagPath tagPath;

tagPath = TagPathParser.parse(“Tag/Timestamp”);
context.getTagManager().editTags(Arrays.asList(tagPath), tagDiff);

Ah, you’re absolutely right… by doing that, you’re creating an “extension” for the tag, which will get applied on load. Don’t know why I didn’t think about that… it’s basically the same as going in the designer, editing the tag, and changing the format.

Anyhow, I will put the new version of configureTag in for 7.4, to make everything easier.

Regards,