Ankündigung

Einklappen
Keine Ankündigung bisher.

Empty Text/String - Logic Block

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    X1 Empty Text/String - Logic Block

    Hi,

    I'm looking for a way to evaluate whether a 14-byte string/text is empty. The "Textformatierer" node is a really handy tool (Thank you Horst!), but it does not allow to evaluate whether there's no text in the 14-byte object. A value compare logic block, but then for 'strings' in stead of 'integers' would be a nice solution, but this does not exist as far as I know.
    The idea is to automatically visualise a different 14-byte object if the primary object does no longer contain any text.
    So:
    - If 14 byte contains text => output 0
    - If 14byte does no longer contain text => output 1

    Any ideas how to fix this?

    Sincerely,

    Thijs

    #2
    Horst is faster than you can think: He also published his "Formelberechnung"; feed your 14-byte string/text into one input and use the property length of this input variable to decide what you want to do.

    Kommentar


      #3
      Thank you Paul! I never thought that the solution would be that easy. It works fine :-).

      Thijs

      Kommentar


        #4
        Actually I need to come back on this.

        I tried both expressions in the "Formelberechnung": {a:S}.Length and {a:S}.Equals("").
        Both expressions work perfectly in the logic simulator, however when I upload this logic to the X1 I'm unable to detect whether the string is empty.
        There's no reaction in the logic when the string is Null/Empty.
        There might be an option to use String.IsNullOrEmpty, but I don't know exactly how to do this.

        Any other ideas?

        Kommentar


          #5
          I didn't try my proposal on a X1. Common use in software is
          • concatente input string with "X" for example
          • compare result of concatenation with "X"
          • if true, the input string was empty
          this action depends on a telegram with the empty string to arive as a trigger for the logic.

          Kommentar


            #6
            Hi,

            This is actually the way I created the logic now. However for some reason it does not work on the X1.
            The string on the input side is empty/blank but this does not trigger the logic. Even when I write a blank value via the Group Monitor in ETS the logic does not trigger. If I write a space (which is a ASCII code as well) there's a reaction. Even when I try to concatenate 2 strings it doesn't work because string 2 is just blank and does not trigger the expression in the "Formelberechnung". It looks like there's no real Write command on the bus for a blank/null/empty string.
            In the logic simulator on the X1 it works fine since you are able to "write" a Null/Blank/Zero value in the simulator.
            However in real time the Null value comes from the Sonos Author Datapoint... The whole idea is that I only have 1 display line available. So I want to display the Author as a primary option, however if the Author String is empty/null I want to display the name of the playlist.
            Still trying to find a workaround however no luck so far....

            Thijs

            Kommentar

            Lädt...
            X