Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Report Pro 2.30a - concatenating variables 11 Nov 2019 03:50 #11683

  • BiggyRat
  • BiggyRat's Avatar
  • Topic Author



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

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Report Pro 2.30a - concatenating variables 11 Nov 2019 13:37 #11685

  • robert
  • robert's Avatar


  • Posts: 3595
  • 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
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Report Pro 2.30a - concatenating variables 12 Nov 2019 00:28 #11702

    • BiggyRat
    • BiggyRat's Avatar
    • Topic Author



    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!

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1