Report Pro 2.30a - concatenating variables
Posted: Mon Nov 11, 2019 2:50 am
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
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