cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Print each record into a string

Former Member
0 Likes
1,401

Hello world!

I've been fighting with this for hours at this point and am finally going to ask - I haven't been able to find this answer anywhere online:

I need some way to select each visible record in my report in a loop, something like {OrderNumber}[i]. Here's my code:

local NumberVar i := 0;
local NumberVar recordCount := Count({eWRLocations.Location Code});
global StringVar stringOutput := "";
local stringVar toAddToOutput;
local NumberVar currentrecord;

WHILE recordCount >= i DO
    (
    currentrecord := ***{Order Number}[1]***;
    toAddToOutput := Cstr(currentrecord, 0, "") + ToText(" ");
    stringOutput := stringOutput + toAddToOutput;
    i := i + 1
);

IF stringOutput = "" THEN "Nope, you messed up"
ELSE
    stringOutput

Everything I've tried up to this point (like RECORDNUMBER) just repeats the total count of records, as in, 861 repeated 861 times.

Two other things to consider

This report is an aggregate of several reports and has 6 different details sections, so using a counter for the detail lines doesn't work

and

there's a bunch of hidden rows so I'd like to only include visible (non-suppressed) rows in the final string output.

The End Goal is to compile a list of visible order numbers into a single string field in my report. It's odd, I know, but makes an audit process much faster. In the end, I'd like to turn something like this:

10001 A

10002 B

10003 B

10004 C

...

10100 AA

to something like:

10001 10002 10003 ... 10100

Thanks in advance!

View Entire Topic
former_member292966
Active Contributor

Hi Matt,

Rather than do this in the Detail section, can you create a group based on {eorder Number}? Then move this formula in the Group Footer? This will make sure only the unique orders are processed and not duplicate them.

You can remove the InStr part of the formula as well.

BTW, I used the InStr function with two variables and it did work.

Thanks,

Brian

Former Member
0 Likes

Grouping by order number would make this much easier, and I would love to do just that. However there are loads of order numbers that are suppressed that create 'blank' groups. For context, this report looks at all orders from the previous day and flags abnormal values. What is/isn't abnormal is determined by 5 very long and complex formula fields, so there's way too many criteria to simply exclude orders with normal values via the original query.

If I suppress the group headers I still have the blank group detail lines, which just gums up the appearance of the report. Like this:

If you know how to completely suppress blank group headers and their blank detail lines I would be extremely grateful. I've scoured the web and haven't found a way to do this. It would be an excellent solution for this and another report we're working on.

Edit: Fixed some bad grammar