I have begun my journey into gamma (again) by trying to read values from a json file. I am getting a bit of success, but it is not quite like I want it.
My problem is that i need the value in the field “Vaerdi” when I have a certain “AnalysetypeId” see attached zip for patch and a sample json file. I do get that, but besides the correct slices, I also get empty slices.
I also feel that I am not doing this in an optimal way.
So any advice on how I can just get the slices that have the right content?
You could use XPathGetValues with this query : /Svaroversigt/Svaroversigt/Laboratorieresultater[AnalysetypeId="iupac_NPU03568"]/Vaerdi. You would retrieve all the Vaerdi where AnalysetypeId is iupac_NPU03568.
Pro tip : there is a Visual Studio Code plugin called XML Tools that allows you to highlight some portion of an XML document and automagically give you the correct XPath query to retrieve it.
just to add to @sebescudie’s Pro Tip, you can do the same in chrome or Firefox by using the dev tools (Ctrl+Shift+I in FF), then navigating to the specific element and selecting, then: right click/Copy/XPath: