String to Structure

vaportrail's picture

Hello everyone,

I need some help with one of my compositions. My input is a String with numbers seperated by commas, like "0,1,33,51", meaning that the status of buttons 0,1,33,51 should be set to 1, while the other buttons should be set to 0. My Idea is to convert it to a structure where the on/off status of each button is saved everytime the input string changes. I tried it with an iterator, iterations=count of my buttons, that compares each number in the input string with the current index, if it matches it should write "1", if not "0", and connected it to a queue patch. But somehow it´s not working because it only queues matches from the beginning. if there´s a mismatch the rest of the members are getting a "0" status.

i attached a file to show what i mean. the status for members 0,1 and 2 are written correctly, the rest gets a "0". Can someone help me & is there a solution without javascript (I have no js skills) ? Maybe i just misunderstood how iterators work...

thank you, vaportrail

PreviewAttachmentSize
string to structure.qtz24.08 KB

benoitlahoz's picture
Re: String to Structure

Hi,

I don't know how your buttons are drawn, but I attach a sample composition I made on your idea. Didn't test it a lot though, but it'll show you how iterator can work. The "enable" thing is treated by a javascript.

I think your trouble in your comp is that you want to detach the treatment of your string from the display of your buttons.

PreviewAttachmentSize
EnableStringStructure.qtz30.57 KB

cybero's picture
Re: String to Structure

What would be the limit on the number of rows and columns? Is there any limit on the length of string?

blackburst's picture
Re: String to Structure

cybero wrote:
Is there any limit on the length of string?
hahaha