Facility Control

 View Only
  • 1.  Appending a string parameter

    Posted 11-23-2016 12:46

    Hi,

    I'm trying to concatenate a bunch of different parameter values into a single string. Is there any easy way to do that with a loop?

    This is what I am doing:

    var a1 = params.getValue('homeScorer1', 0) + params.getValue(homeScorerTime1', 0)
    var a2 = params.getValue('homeScorer1', 1) + params.getValue(homeScorerTime1', 1)
    var a3 = params.getValue('homeScorer1', 2) + params.getValue(homeScorerTime1', 2)
    params.setValue('stringGame1', 0, a1+a2+a3);

    However I would like to do something like this:

    for (i = 0; i < 20; i++) {
       var a(i) = params.getValue('homeScorer1', i) + params.getValue(homeScorerTime1', i);
       params.setValue('stringGame1', 0, a(i));

    Is there any way of doing this differently as I can't seem to get more than one "homeScorer" and "homeScorerTime" into my "stringGame1" using a for-loop? Is there any syntax for "appending" to a string?

    I realize I might be way off, so any help would be greatly appreciated!

    T



  • 2.  RE: Appending a string parameter

    Posted 11-23-2016 15:51

    You can create a string and then simply use "+" to add to it.

    var a = "";
    for (var i = 0; i < 20; i++)
    {
      a += params.getValue('homeScorer1', i);
      a += params.getValue(homeScorerTime1', i);
    }
    params.setValue('stringGame1', 0, a);

    #DashBoard


  • 3.  RE: Appending a string parameter

    Posted 12-27-2016 12:35
    Thank you!
    #DashBoard