1 Reply Latest reply on May 28, 2018 2:14 PM by Marcos Vainer Loeff

    PI-web API R-client (SearchByAttribute Method)


      I tried to perform a search by attribute request using the PI webAPI R-client. In my opinion the tow R-objects PISearchByAttribute.R and

      PIValueQuery.R must be slightly adjusted (I attached my proposal).


      Have I understood the syntax correct, or is there already a working

      solution available ? If not, could the changes be checked for any side-effects on the rest of the code (I discovered none at the moment) ?

        • Re: PI-web API R-client (SearchByAttribute Method)
          Marcos Vainer Loeff

          Hello Christopher,


          I have added a tab as proposed for all R objects. There is no need to make more changes, since the code below worked fine for me:


          response12 <- piWebApiService$element$getByPath("\\\\PISRV1\\City Bikes\\(TO)BIKE")
          response13 <- piWebApiService$elementTemplate$getByPath("\\\\PISRV1\\City Bikes\\ElementTemplates[BikeStationTemplate]")
          valueQueries = list();
          valUeQuery1 <- PIValueQuery(attributeName = "Latitude", attributeValue = 0, searchOperator = "GreaterThan")
          valueQueries[[1]] = valUeQuery1
          search1 <- PISearchByAttribute(searchRoot = response12$WebId, elementTemplate = response13$WebId,  valueQueries = valueQueries);
          response14 <-piWebApiService$element$createSearchByAttribute(search1, FALSE, NULL)
          searchId = substr(response14$headers$location,65,1000000)
          response15 <-piWebApiService$element$executeSearchByAttribute(searchId)




          Hope this helps!