Azure-Player / Real-Time-Data-Simulator

Windows Desktop application to generating and streaming data into EventHub
MIT License
5 stars 5 forks source link

Fueltype is not populated #5

Closed KoenVerbeeck closed 3 months ago

KoenVerbeeck commented 3 months ago

There seems to be an issue with the FuelType column, which always has the value "{{FuelType(MessageIndex)}}"

image

thedaxshepherd commented 3 months ago

This code causes an error due to the index for the array going beyond the bounds if you set the number of messages to 20 or more.

Error_20Messages

Below are two methods I put in place so that I could continue testing with more than 20 messages. My theory on why MessageIndex was being used to select the fuel type was that eventually one of each fuel type would be represented in the data set. I tried to honor that intention.

  if (key == "FuelType(MessageIndex)")
  {
      String[] arr = val.Split("|");

      //int i = rnd.Next(0, arr.Length); // if goal is to have random fuel type, uncomment this
      int i = msgIndex % arr.Length; // if goal is to iterate through fuel types, uncomment this
      val = arr[i];

      //val = arr[msgIndex]; // Causes an out of bounds error at 20 messages
  }
NowinskiK commented 3 months ago

Feel free to prepare PR - I'm happy to accept it and merge.