Smiffy
3rd April 2002, 13:12
I have a requirement to display many fields across a report.
The fields represent values for week and day and go right through the year.
e.g.
Week1Day1 Week1Day2 Week1Day3
I can display the fields by using an array which will show the field values across the page;
e.g.
1224|1233|1212|1222 (using a pipe symbol to act as a line).
I wish to know if there is a way to create a variable name.
i.e. W1D1 W1D2 W1D3
Can loops be used to automatically create the variable name and then populate it with a value ?? Obviously the variable name would have to have been set up in the definition part of the script.
Obviously I dont want to hard code the population of each variable indivdually. It would be nice if a loop or loops could perform this task.
Or should I stick with the idea of using a long string array to display the results ??
Dwallace
3rd April 2002, 15:51
Why can't you just use the fields in the array on the report - using the values in the arrayed fields?
I have a similar report where I print company data across the page. Then, if the column/array field is empty, I don't print that column.
My array is set to 20 (all I can reasonably fit across legal paper), and I can print from 1 to 20 columns, depending on the data.
Denise
MariaC
3rd April 2002, 16:14
As Denise says, use the array.
eg. wid(20) array of 20
on the report you can have
wid(1)|wid(2)|wid(3)|etc..
Dwallace
10th April 2002, 18:42
Smiffy - were you able to solve your problem? I was re-reading this and realized you asked about DISPLAY not PRINT - so the answers may not have solved anything.
In your display - what type form are you using? Are you summarizing data? I'm working on a similar project.
Denise
mark_h
10th April 2002, 20:02
I had a requirement to generate a capacity report in landscape with the reporting periods across the report in the headers. With one page per main or sub-work center. The reporting period was either year/month or year/week - depending on a option the user selected on the form. I am going to simplify it a little bit to describe what I did - maybe not the best solution, but it worked.
First I created a report in report group 2 - it had 3 fields (in this simplified version):
Work Center,Period,Hours. It was a normal report. So when the user clicked on continue the first thing I did was save off the spool.device, change report group and run the above report into a ascii file. The only exception was that I had to make sure for each main or sub-work center I had a record for all the reporting periods.
Next I then read this records into a series of arrays. Since I new each work center was going to have 12 records. I could read 12 records and then print - continuing until I was out of records. My header record had one array in it (the one for the periods) and my detail line had another array for the capacity hours. The report kind of looks like this:
header layout
some report title
hdr(1) | hdr(2) | hdr(3)
detail layout
det(1) | det(2) | det(3)
I attached a screen print(Word document) of the report from one of our test companies. Not sure if it helps or not.
Good Luck!
Mark
Smiffy
11th April 2002, 11:19
Hi,
Denise, I was referring to a report. Sorry about the confusion.
I was not aware that on the report layout, you could use an array field (a particular instance e.g. array(3)). I may try this in the future.
I solved my problem by having 35 field (named col1 - col35). I simply used loops and arrays to compile the data for each item and then used one standard array to load the data to be printed per line to the columns. This solution has worked perfectly.
thanks to everyone.
tnzabo
1st August 2002, 19:27
Hello Smiffy,
I know this was an old message but I just came across the same problem. I have a question on how you defined your col1 - col35 fields. Did you use a domain and that was it? The reason I'm asking is because I have an hours field and a dollars field. I'm using them as arrays. There are only two field names that I use across the board for 6 different columns. I have a sub i that I increment in a loop and when I report them across I say
hours(1), hours(2)...
The problem I'm facing with this is, in my declaration I've said domain blahblah hours(1000) - if the value in the hours field goes over 1000 I get out of dims errors. So I'm constantly going in and increasing that number. It's really out of hand.
Any advice?
tnzabo