Skip Text Fields with Blank text

SinaSina Member Posts: 33
Hey everyone.

I have 7 text boxes with labels for outprinting vehicle data one under another in a report. When the text in the first textbox is blank, I want to skip the first textbox and take the second one. If the second one is not empty it should take place in the place of the first textbox, but when the second textbox is blank, too, it should skip to the third textbox...and so on...

Does anybody know how to realize this? :-k

Thank you.
Sina

Comments

  • kapamaroukapamarou Member Posts: 1,152
    I assume you are talking about a report. You could use a lot of sections and toggle the SHOWOUTPUT but I would add TextConstants for the labels, add an array of equal text variables and then assign each value to the corresponding array element and assign this to the textbox...
  • SinaSina Member Posts: 33
    Yes I created an array called VehicleData for the text box and VehicleText for the labels. But what I don't know is how to realize to skip the blank textbox and take the next one with a text within...
    Sina
  • hs_mannhs_mann Member Posts: 17
    Try using Function COMPRESSARRAY

    Harjot
  • kapamaroukapamarou Member Posts: 1,152
    If you have 10 textboxes then you can:

    textbox1 -> SourceExpr = textArray[1]
    textbox2 -> SourceExpr = textArray[2]

    .
    .
    .
    textbox3 -> SourceExpr = textArray[3];

    If you have empty array elements in the middle then you can do
    COMPRESSARRAY to move all values at the beginning...
  • SinaSina Member Posts: 33
    It works fine for the text boxes, thanks. Do you know how to use this for the labels? Because the labels are never empty and when the textboxes are empty, the labels should be empty, too.
    Sina
  • boywonderboywonder Member Posts: 179
    change the labels into text boxes and place them in an array too :wink:
  • SinaSina Member Posts: 33
    That's not possible, because there is still a text inside the label and when it would be a textbox that wouldn't change anything. That's the problem...
    Sina
  • hs_mannhs_mann Member Posts: 17
    Hi

    I think you should use the SHOWOUTPUT as suggested by kapamarou.

    Create Seven Sections one for each Textbox and in OnPreSection trigger use

    CurrReport.SHOWOUTPUT(VehicleData[1] <> '');

    Change the Number of Arrayvalue for each Section

    Harjot
  • boywonderboywonder Member Posts: 179
    you can decide whether to populate the label [changed into a text array as I suggested] on whether or not the corresponding text has anything in it, unless I misunderstand your requirement?
  • SinaSina Member Posts: 33
    Problem solved, thank you. When the textboxes are empty I changed the content of the labels into empty (:= '') and at the end used COMPRESSARRAY for the array of the labels.

    \:D/
    Sina
  • SinaSina Member Posts: 33
    SHOWOUTPUT doesn't work with this because I have more textboxes in one section which I cannot set to SHOWOUTPUT(FALSE), it works fine now. Thank you.
    Sina
Sign In or Register to comment.