Question: ```
    i.Notes, SUM(l.Discount) AS Dcount, i.DiscDate, i.DueDate, i.UIMth, i.UISeq, poj.Job, poj.Description, i.UniqueAttchID, i.ReviewerGroup AS RevGrp, SUM(l.GrossAmt) 
                     AS GrossAmt, v.PayTerms, dbo.HQPT.DiscRate, i.InvTotal, DATEDIFF(day,getdate(),i.DiscDate) AS DiscDays,
--Trying to use the DiscDays and Dcount here    
                    if DiscDays, between '20' and '11' THEN sum(Dcount) as YelDisc  

```

I am hoping someone can help me here. I am very new to T-SQL. I believe what I need here is a sub Query but I'm not sure how to format it correctly 

Thank you

Answer: 
`public String readLine()` will read a line from your file, even empty lines. Thus, when you split your line, as in `String[] data = line.split(",");` you get an array of size 1.
Why not try :

```
if (data.length >= 7)
{
    System.out.println(data[0] + " - " + data[6]);
    int changeId = Integer.parseInt(data[0]);
    int changeCv = Integer.parseInt(data[6]);
    changeData.put(changeId, changeCv);
}

```

which will make sure there are at least 7 elements in your array before proceeding.
To skip blank lines you could try:

```
while ((line = reader.readLine()) != null) {
   if(line.length() > 0) {
      String[] data = line.split(",");

        /*Below is my latest attempt at fixing this,*/ 
        /*but I've tried other things too.*/
        if (data[0] == null || data[0].equals("")) { break; }

        System.out.println(data[0] + " - " + data[6]);
        int changeId = Integer.parseInt(data[0]);
        int changeCv = Integer.parseInt(data[6]);

        changeData.put(changeId, changeCv);
   }           
}

```