I would like to have a string appear like:
DDH X 2, HIAB X 5, FLATBED X 2, TABLETOP X 4
etc up to 10 different type trucks and the number used. Due to field length limitations in ReportPro, I've had to break it into 4 different variables, as shown below:
//TrucksUsed1
iif( Empty(Costings.T1) == .F. , AllTrim(Costings.T1) + " x " + AllTrim(Str(Integer(Costings.Tq1))) + ", ", "") + iif( Empty(Costings.T2) == .F. , AllTrim(Costings.T2) + " x " + AllTrim(Str(Integer(Costings.Tq2))) + ", ", "") + iif( Empty(Costings.T3) == .F. , AllTrim(Costings.T3) + " x " + AllTrim(Str(Integer(Costings.Tq3))) + ", ", "")
//TrucksUsed2
iif( Empty(Costings.T4) == .F. , AllTrim(Costings.T4) + " x " + AllTrim(Str(Integer(Costings.Tq4))) + ", ", "") + iif( Empty(Costings.T5) == .F. , AllTrim(Costings.T5) + " x " + AllTrim(Str(Integer(Costings.Tq6))) + ", ", "") + iif( Empty(Costings.T6) == .F. , AllTrim(Costings.T6) + " x " + AllTrim(Str(Integer(Costings.Tq6))) + ", ", "")
//TrucksUsed3
iif( Empty(Costings.T7) == .F. , AllTrim(Costings.T7) + " x " + AllTrim(Str(Integer(Costings.Tq7))) + ", ", "") + iif( Empty(Costings.T8) == .F. , AllTrim(Costings.T8) + " x " + AllTrim(Str(Integer(Costings.Tq8))) + ", ", "") + iif( Empty(Costings.T9) == .F. , AllTrim(Costings.T9) + " x " + AllTrim(Str(Integer(Costings.Tq9))) + ", ", "")
//TrucksUsed4
iif( Empty(Costings.T10) == .F. , AllTrim(Costings.T10) + " x " + AllTrim(Str(Integer(Costings.Tq10))), "")
Problem is when TrucksUsed1 runs out and TrucksUsed2 starts, theres a large gap between the two:
Alltrim doesn't seem to work - it produces a runtime error using this code in ReportPro:
Alltrim(TrucksUsed1) + ", " + Alltrim(TrucksUsed2) + ", " + Alltrim(TrucksUsed3) + ", " + Alltrim(TrucksUsed4)
But the query builder says the expressions are valid. What am I missing please?
Thanks again guys.
Jeff
Report Pro 2.30a - concatenating variables
Report Pro 2.30a - concatenating variables
Jeff,
Can you include an example report and its datafiles ?
Alltrim should work, so there must be another reason why this fails.
Most likely the order in which you have defined the expressions is the reason for the problem. Make sure that the variable that uses TruckUsed 1 .. 4 is later in the list than the variables that it uses.
Robert
Can you include an example report and its datafiles ?
Alltrim should work, so there must be another reason why this fails.
Most likely the order in which you have defined the expressions is the reason for the problem. Make sure that the variable that uses TruckUsed 1 .. 4 is later in the list than the variables that it uses.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Report Pro 2.30a - concatenating variables
Genius! Thank you Robert..
"the variable that uses TruckUsed 1 .. 4 is later in the list than the variables that it uses." That fixed it!
"the variable that uses TruckUsed 1 .. 4 is later in the list than the variables that it uses." That fixed it!