More combobox craziness

  • I've got a rather complicated action to populate a combobox.

    The first thing is does is set everything to zero and then loop through mapspots, count them by group and return the numbers.

    Problem #1 is that this calls the second action add_group_items() everytime it loops when it's only supposed to call it when it reaches the total number of mapspots.

    Problem #2 is that when it populates the combox the text is all over the place, on different lines and a bit mental.

    This works fine without the languages element added, however the problems are probably related.

    Any ideas?

  • Hi viewinz,

    Zitat

    Problem #1 is that this calls the second action add_group_items() everytime it loops when it's only supposed to call it when it reaches the total number of mapspots.

    About this, Instead of 2 if() action, perhaps you can use an if(condition, trueaction, falseaction); into your loop_all_group_items() action...
    Your lines code 25 and 26 would become:

    Code
    if(g LT %2, loop_all_group_items(get(g),%2), add_group_items(get(g),get(lang)));


    I have not tested but I think this can resolve your first problem...

    Salut.

  • Michel, thank you that solved the first problem great.

    The second problem appears to have been line breaks in my data nodes, i.e.

    Code
    <data>....</data>

    worked but..

    Code
    <data>
    ....
    </data>

    Doesn't work.


    The next issue I'm having is the count is wrong if run twice. I.e the first time it runs it counts correctly, the second time it only counts 3 actual scenes, but all 6 mapspots. Even tho everthing is set to zero and removed when it is run each time.

    Weird.

    Anyway here's the new code with your change to see if you can see anything!?

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!