amarpreet
6th January 2003, 07:33
I want to select specific customers on report input for report based on table tdsls040.

In other words I would like to use functionality "enter specific customers - Yes/No".

If YES script should record specific customers & if NO script should select range of customers.

I know this thread may sound absurd to anyone, as I am a functional person & this is my first complicatd session.

Please help me.

Amarpreet Singh

morpheus
6th January 2003, 08:56
Option A

If "No" -
Let the user enter the range of customer code.

If "Yes" -
Let the user enter only "cuno.f", and disable the input for "cuno.t".

Option B

If "Yes" -
Zoom to another session, and let user specify the specific orders.

If "No" -
Let the user enter the range of customer code, in the same session.

amarpreet
6th January 2003, 10:08
Dear Morpheus

Thanks for the reply.

Can u please help me in generating the subsession for capturing selective customers. I had a script with me for capturing specific order numbers, but that doesn't work as the data type is different for order no & customer no, it is long in tcorno & string in tccuno.

I am attaching script for capturing specific order no's

thanks for spending time for me.

Ruskin
7th January 2003, 03:49
One option is to have a session with 2 forms...

On both forms have the same fields (ie: order from and order to, item from and item to, etc...). Including the option of 'Enter Specific Customers Yes/No' on both forms. Ensure all the field names are the same (otherwise it's a pain having to code for both field names, ie: orno.f and orno.t are the order ranges on both forms, as opposed to orno.f1, orno.t1 and orno.f2, orno.t2 for the fields on both forms).
Anyway, on one form have only cuno.f and cuno.t (for customer range) and on the other form have as many customer fields as you need (maybe an array would be useful here....).
When the user changes the value of 'Enter Specific Customers' simply interrogate this value and flick to form 1 or form 2, eg:

field.spec.cuno:
when.field.changes:
if spec.cuno = tcyesno.yes then
to.form(2)
else
to.form(1)
endif

Then when you do your select statement, simply see which form is current to determine if you do a selection on individual customers or the range. eg:

if form.curr = 1 then
do.selection.by.customer(cuno.f, cuno.t)
else
for x = 1 to num.arrays
if not isspace(form.cuno(1,x)) then
do.selection.by.customer(form.cuno(1,x),form.cuno(1,x))
endif
endfor
endif

function do.selection.by.customer(domain tccuno from.cuno,
domain tccuno to.cuno)
{
select tdsls040.*
from tdsls040
where tdsls040._index1 inrange {:orno.f} and {:orno.t}
and tdsls040.cuno inrange :from.cuno and :to.cuno
selectdo
| ....
endselect
}

Of course, if they don't put in an order range, this will cause full table searches for every entered customer. So you may want to refine the query (maybe use the 'IN' statement), but I'm sure you get the idea...

Ruskin
7th January 2003, 03:51
Sorry, when I wrote the post, the script was correctly spaced, but they seem to have dissappeared, making it a little hard to read.

Also, the funny faces in the index search are supposed to be colon's and the letter 'o'....

amarpreet
8th January 2003, 09:58
Thanks Ruskin

I got the solution.