StringConcatenate does not preserve the string_var in for loop - page 2

 
samjesse:

MT5.

Ok. This one works:

void OnStart()
  {
   string dt="";
   
   for(int i=0;i<=1;i++)
     {
      if(i==0)
      StringConcatenate(dt,dt,"my date _ ");
      else
      StringConcatenate(dt,dt,"my time");
     }
     Print(dt);
  }

Please, note how dt is used TWICE in StringConcatenate, once as output string and one more time as an input string...

 
samjesse:

The reason for having the variable inside the first loop (and not the the beginning of the function) is to clear it from it content every time so that the second loop builds the new intended string consisting of the date and time "as coded".

ELSE IF block will be executed the first time which will allow the "dt" string to have the date and the second time to add the time to the date. Remember, the "dt" has not be re initialized to a "" string yet as the second loop is running. It only gets re initialized when the first loop runs.

What Am I missing???

I think that your XML structure is messed up in some way. Put a print after getting the values... something is wrong:

          string name = SubNode.getName();
          string value = SubNode.getValue();
          Print("j:",j," name:",name," value:",value);


;)