2 Replies Latest reply on Jul 2, 2019 2:17 PM by Jon Trotter

    Assigning a variable issue

    Jon Trotter
      Share This:

      I honestly feel stupid as to why I can't get this to work. I can run the query in the GUI and get back exactly what I am expecting, but when attempting to run in a pattern, there are no results (based on the pattern stopping). There are records from discovery accesses for the network devices, but when attempting to assign the variable da, it basically does not return anything. I have attempted to have if da.endpoint then... and other attributes, but nothing comes back. Is this traversal and assignment invalid in TPL? I've seen something very similar done from the DA node to other related nodes, thought this would be valid since the query works in the GUI.


          triggers on

              nd := NetworkDevice created, modified;

          end triggers;




          da := search (in nd traverse InferredElement:Inference:Associate:DiscoveryAccess where result = "Success");


          if da then

              log.info("This is a marker to identify the pattern is still running");


              log.info("Records not found for the DA, this pattern will stop");


          end if;

        • 1. Re: Assigning a variable issue
          Andrew Waters

          The InferredElement:Inference:Associate:DiscoveryAccess will have already been moved to the current DA by the time the pattern is running and hence the result is not yet Success.


          Why not just use discovery.access()

          1 of 1 people found this helpful
          • 2. Re: Assigning a variable issue
            Jon Trotter

            Thank you Andrew, I thought the data would be available in the datastore regardless of the run since a record does exist, but it makes sense what you are saying. I haven't had need yet to use that function, will take a look at it. It will probably do what I need. Thank you for responding!


            Correction: I have used this in the past, but honestly forgot about it. I found a pattern where I had used it once I started looking. Thanks again!