Getting the value of the History Provider

In Ignition 7 Java code I was able to do the following to get the name of the History Provider when it was enabled.

String historyProviderName = tag.getAttribute(TagProp.PrimaryHistoryProvider).getValue().toString().toLowerCase();

Is there a way to get this same value in Ignition 8 since I can no longer use tag.getAttribute when browsing through tags. I am using browseAsync now to browse tags and it gives me NodeDescriptions, not tags

Results<NodeDescription> results = provider.browseAsync(parentPath, BrowseFilter.NONE).get(30, TimeUnit.SECONDS);

You would need to build a TagPath where the last component is the PrimaryHistoryProvider tag prop and then call readAsync with that path.

1 Like

Here is what I have done from my interpretation of your response.
I don’t believe this is correct though since I am getting QualityCode.Bad_NotFound on my tags that have the history provider enabled.

            TagPath histEnabledPath = new PropertyAlteredTagPath(tagPath, WellKnownTagProps.HistoryProvider);
            List<TagPath> testlist = new ArrayList<>();
            testlist.add(histEnabledPath);
            List<QualifiedValue> valueList = provider.readAsync(testlist, SecurityContext.emptyContext()).get();

            for (QualifiedValue tempValue : valueList) {
                if(tempValue.getQuality() != QualityCode.Bad_NotFound){
                    String historyProviderName = tempValue.getValue().toString();
                }
            }

Hmm. That seems right. You can use tagPath.getChildPath(WellKnownTagPaths.HistoryProvider) as a shortcut, but doubt that’s your problem.

Can you read other properties like this? Try reading the Value etc… and make sure the TagPath is correct.

Perfect, thank you so much - I did have the TagPath incorrectly formatted - I didn’t realize I needed the entire path including the folder it was in: something like this
[folderName]/[subFolderName]/[testingTag123]