Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering Txt per row

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
972
GB
I have a report that uses a parameter to get the order number. The order may have multiple order lines or just one. Also the order lines may need severl text entries below each line.

For example I am getting the user to enter the order number via parameter and then have another parameter asking to add Pack information (free text as we don't have a way to link the information in the database)

Order Number : 12345
Pack : 800800 2404/2

The report then shows the

Product Description (brought form the Database)
Pack: 800800 2404/2

This works great if we only have 1 pack and one order line. However this is not always the case, sometimes we may have one order line and many packs. And sometimes many order lines and many packs per order line.

So a couple of questions which I hope someone can help with

1. How can I allow the user to enter txt for many packs.
The parameter is currently set like "Pack: " + {?Pack} and I have it set so it can grow.
When prompted I enter 800800 2404/2 but if I press return expecting it to go to the next line it runs the report, ideally I want to be able to enter the first row
800800 2404/2 then another
800800 2404/3 etc... until all packs are entered. I also want the Pack: to be at the front of each one to save typing it in every time.

2. However, as I mentioned I may have more than one order line, so I may need to add packs under separate lines. so we may have for example

Line 1
800800 2404/2
800800 2404/3

Line 2
800800 2404/4
800800 2404/5

Because I am using parameters I do not know how many Lines I have until the report is refreshed. So any ideas how I get around this one please.

Thanks


 
I now have my parameter for the free text like this

"Pack: " + {?Pack} +" "+ "Pack: " + {?Pack1} +" "+ "Pack: " + {?Pack3}

And this works fine if there is only one order line.

Also in the report I have a field called
ToText({OrderLine.LineNumber}, 0) and this gives me a number with the order line. It numbers them, 1, 2, 3 etc.... depending on how many lines.

I think I need somehow to say if line 1 is there then enter Packs, then if row 2 enter packs, if row 3 exists enter pack
and the text entered goes below the relevant row.

How to achieve this is another thing, any ideas please
 
One way to do it would be to chnage to prompt on you Pack parameter to say "Enter Packs Separated by comma"
Then if they enter something like: 2402/2, 2402/3 you can use Split to convert the parameter into an array, then do a comparison like:
If {table.pack} in split({?Pack},',') then . . .
 
Hi

Thanks for the reply. I am slightly confused with your reply, but I do think the split function may work, but I have tried to apply it but not working thus far.

I am doing a basic example just to try and get the formula working and then try and apply to my real report.

I have a parameter called Pack and a formula called Pack1.

I want the parameter to ask for the txt to enter (this bit works) and the person would enter a long string something like

8022174/T 240/4.2, 8045380/T 240/4.8, 8033683/T 240/4.8

It could be longer but we could always split it with a comma and then want it to look like this

Pack: 8022174/T 240/4.2
Pack: 8045380/T 240/4.8
Pack: 8033683/T 240/4.8

I have tried to get the formula in Pack1 to work but get continual error messages. currently it is like this but the result just says FALSE

If {?Pack}in split ({?Pack},',') then {?Pack}={?Pack} else false

I also would not min if possible for the word Pack: to always be in front of them as displayed above

What should the code look like please?

Thanks


 
your then and else must be of the same type
Instead of else false
try
else "
 
Hi

Tried that is says then it is expecting a Boolean

Thanks
 
Sorry, I read that wrong.

That formula is always going to be false because you're comparing the unsplit string to an array. When you split the string into an array the delimiters are gone, so your string of "A,B,C" will never be found in an array of "A", "B", "C"

I think you want to see if a field is in the array. So it would be more like: If {table.field} in split({?Pack}) then true else false
 
Hi

I think I am perhaps not explaining very well.

The parameter is asking for pack information. This is random text and is not store in a table so does not have a filed name.

The text entered would be like
8022174/T 240/4.2, 8045380/T 240/4.8, 8033683/T 240/4.8

and I need it to look like the below when it hitting the ok button.

Pack: 8022174/T 240/4.2
Pack: 8045380/T 240/4.8
Pack: 8033683/T 240/4.8

Thanks



 
How please, I have tried everything I could find on google and tek site, pulling my hair out slightly to be honest,

Thanks for the replys by the way appreciate any help
 
Edit your parameter. In the bottom of the Edit Parameter window there is a box that says Value Options. The fifth line is "Allow Multiple Values" - change the setting from False to True.

You can now enter multiple values in your parameter. The parameter itself is now an array.
 
It only shows the first row of information I put in.

the parameter is set to multiple values and I have used the parameter in the details section rather than the formula. Also resized the box but still can only see 1 row of info.

Also I would like to put Pack in front of each one without typing is this possible

Thanks
 
You only see one row because it is an array. If you just put it on your report then you will only see one row. You need a formula to convert the array to a string to display it.
 
Again how should the formula look please, sorry but I am getting totally lost with this

Thanks
 
Hi

Does anyone have some example formula on this please. I have tried to apply some but cannot get it to work. I keep just getting one row of txt.

Thanks
 
Hi

I found some code and adapted and this appears to work ok now

WhilePrintingRecords;
StringVar Array Input := {?Pack}; // replace this with your string prompt
NumberVar howmany:= count (Input);

Input [1] +
if howmany > 1 then ', ' + Input [2] +
if howmany > 2 then ', ' + Input [3] +
if howmany > 3 then ', ' + Input [4] +
if howmany > 4 then ', ' + Input [5] +
if howmany > 5 then ', ' + Input [6] +
if howmany > 6 then ', ' + Input [7] +
if howmany > 7 then ', ' + Input [8] +
if howmany > 8 then ', ' + Input [9]

Thanks for the help along the way appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top