News events array

 

I have a code that reads the xml file from news events for the week and holds various information about the events.

The code for the loop is supposed to only read the next news event in the array but it loops to the last instead.

I am using the code below to do this

if(StrToTime(DDateStr) > TimeGMT())

Any tips to only loop to the next event in the array instead of the last?

      for(int index = 0; index < EventsSize; index++)
        {
         Title = Events[index].TITLE;
         Country = Events[index].COUNTRY;
         Forecast = Events[index].FORECAST;
         Previous = Events[index].PREVIOUS;
         DDate = Events[index].DATE;
         DDateStr = "";
         TTime = Events[index].TIME;
         string TTimeStr = "";
         StringReplace(DDate, "-", ".");
         string aq[];
         if(StringFind(TTime, "pm") != -1)
           {
            StringReplace(TTime, "pm", "");
            StringSplit(TTime, StringGetCharacter(":", 0), aq);
            TTimeStr = (string)(StringToInteger(aq[0]) + 12) + ":" + aq[1];
           }
         else
           {
            StringReplace(TTime, "am", "");
            StringSplit(TTime, StringGetCharacter(":", 0), aq);
            TTimeStr = aq[0] + ":" + aq[1];
           }
         StringSplit(DDate, StringGetCharacter(".", 0), aq);
         DDateStr = aq[2] + "." + aq[0] + "." + aq[1] + " " + TTimeStr;
         ///////////////////////////////////////////////////////////////////////
         if(StrToTime(DDateStr) > TimeGMT())
           {
            if(MainSymbol==Country || SecondSymbol==Country)
               if(Events[index].IMPACT == "High")
                  if(Previous != 0 || Forecast != 0)
                    {
                     if(StringFind(Title, "Unemployment Rate") !=-1)
                       {
                        EventForecast = Events[index].PREVIOUS;
                        EventPrevious = Events[index].FORECAST;
                       }
                     else
                       {
                        EventForecast = Events[index].FORECAST;
                        EventPrevious = Events[index].PREVIOUS;
                       }
                     EventTitle=Events[index].TITLE;
                     EventDate=Events[index].DATE;
                     EventTime=Events[index].TIME;
                     EventSymbol=Events[index].COUNTRY;
                    }
                  else
                    {
                     EventTitle=NULL;
                     EventDate=NULL;
                     EventTime=NULL;
                     EventSymbol=NULL;
                     EventPrevious=NULL;
                     EventForecast=NULL;
                    }
           }
        }
     }
 
Digitals113:

I have a code that reads the xml file from news events for the week and holds various information about the events.

The code for the loop is supposed to only read the next news event in the array but it loops to the last instead.

I am using the code below to do this

Any tips to only loop to the next event in the array instead of the last?

I think you have a < TimeGMT() actually , and also you might want to exit the loop if you find the event you are looking for

 
Issue resolved. Thanks.
Reason: