When nothing is returned
Hi Mumbles,
Got a problem i'm trying to fix. I'm using these values in my code:
(.bestPricesToBack(0).price)
(.bestPricesToLay(0).price)
(.bestPricesToBack(0).amountAvailable) all 3 values
(.bestPricesToLay(0).amountAvailable) all 3 values
Here's a simple version of the code:
With .runnerPrices(i)
If .sortOrder = 1 And .bestPricesToBack.Length > 0 Then
Runner1ID(.selectionId)
If .bestPricesToBack(0).price > 0 Then
Back1 = Math.Round((.bestPricesToBack(0).price), 2)
lblBack1Line1.Text = Back1
ElseIf .bestPricesToBack.Length < 1 Then
Back1 = Decimal.Round(0.0)
lblBack1Line1.Text = Back1
End If
If .bestPricesToLay(0).price > 0 Then
Lay1 = Math.Round((.bestPricesToLay(0).price), 2)
lblLay1Line1.Text = Lay1
ElseIf .bestPricesToLay(0).price < 1 Then
Lay1 = Decimal.Round(0.0)
lblLay1Line1.Text = Lay1
End if
If .bestPricesToBack(0).amountAvailable > 0 Then
Print(.bestPricesToBack(0).amountAvailable)
ElseIf .bestPricesToBack(0).amountAvailable < 1 Then
WomB1L1 = Decimal.Round(0.0)
End If
If .bestPricesToLay(0).amountAvailable > 0 Then
Print(.bestPricesToLay(0).amountAvailable
ElseIf .bestPricesToLay(0).amountAvailable < 1 Then
WL1L1 = Decimal.Round(0.0)
End If
End With
I use the .SortOrder as my filter for all the values for that particular horse or whatever. So i reiterate the above for .sortOrder 2, 3, 4, 5, 6 and this works really well.
The problem come when there is no information in say .bestPricesToLay(0).amountAvailable. If this string returns nothing then it crashes. I tried to counter this by using the elseif statement to insert a value (0.0) but this is not working. Can you offer any advice?
Thanks
Tony
Hi Mumbles,
Got a problem i'm trying to fix. I'm using these values in my code:
(.bestPricesToBack(0).price)
(.bestPricesToLay(0).price)
(.bestPricesToBack(0).amountAvailable) all 3 values
(.bestPricesToLay(0).amountAvailable) all 3 values
Here's a simple version of the code:
With .runnerPrices(i)
If .sortOrder = 1 And .bestPricesToBack.Length > 0 Then
Runner1ID(.selectionId)
If .bestPricesToBack(0).price > 0 Then
Back1 = Math.Round((.bestPricesToBack(0).price), 2)
lblBack1Line1.Text = Back1
ElseIf .bestPricesToBack.Length < 1 Then
Back1 = Decimal.Round(0.0)
lblBack1Line1.Text = Back1
End If
If .bestPricesToLay(0).price > 0 Then
Lay1 = Math.Round((.bestPricesToLay(0).price), 2)
lblLay1Line1.Text = Lay1
ElseIf .bestPricesToLay(0).price < 1 Then
Lay1 = Decimal.Round(0.0)
lblLay1Line1.Text = Lay1
End if
If .bestPricesToBack(0).amountAvailable > 0 Then
Print(.bestPricesToBack(0).amountAvailable)
ElseIf .bestPricesToBack(0).amountAvailable < 1 Then
WomB1L1 = Decimal.Round(0.0)
End If
If .bestPricesToLay(0).amountAvailable > 0 Then
Print(.bestPricesToLay(0).amountAvailable
ElseIf .bestPricesToLay(0).amountAvailable < 1 Then
WL1L1 = Decimal.Round(0.0)
End If
End With
I use the .SortOrder as my filter for all the values for that particular horse or whatever. So i reiterate the above for .sortOrder 2, 3, 4, 5, 6 and this works really well.
The problem come when there is no information in say .bestPricesToLay(0).amountAvailable. If this string returns nothing then it crashes. I tried to counter this by using the elseif statement to insert a value (0.0) but this is not working. Can you offer any advice?
Thanks
Tony



Comment