Count appearances of a value in a structure

zuvala's picture

hi there

Is it possible to detect how many times a value is repeated within a structure? ie. i've got a xml-file with a "date" key and want to create several individual representations grouped for each day.

Or divide a structure in several substructures, when a key value changes?

thanks for any advice

Index from structure search

pho's picture


I have the following structure: 0: (0) Author 1: (1) Editor 2: (2) Publisher 3: (3) etc.

How can I get the Index of an item by searching for a keyword?

For instance, if I searched for Editor I would get 1 as a result.


Structure merge

Swiftlikeninja's picture

I have a structure like the one in the attached picture, Im struggling with a means of combining all the indexes together. so for example the output structure would be ['61405075','6140232'], basically merging the structure together by index.

can anyone assist me with some javascript snippets to point me in the right direction?

Combine Like Keys into String

Swiftlikeninja's picture

I have been messing around with a javascript patch that will loop through a structure (about 1000 entries) and parse out the similar keys into single strings. the Code im using is as follows:

function (__structure structureOut) main ( __structure structureIn)
   if (!_testMode) {
        var Rebuild = new Object();
        for(i = 0; i <structureIn.length; i++) {
           Rebuild[structureIn[i][0]] +=structureIn[i][1];
           var result = new Object();
          return result;

but the end results have an extra 'undefined' entry at the beginning of each new string. Can anyone explain why this is occurring? I've attached a sample compostion to better show.

learning structure

muqeem's picture

Hi all,

I am learning structure and cannot get hold on it. So I thought to drop you all a simple composition (attached). I wanted to trigger these numbers one after another on a signal. I am sure using structure, which I am trying to learn, would do this. Please help, if possible.

Thanks a lot in advance