popeye
17th January 2002, 19:52
Hi,
I have a multi-occ screen showing the PO details.
All the fields except for the Check Box (tgyenox) are table
fields (tdpur041). See the attached pic.
The user can then select the various lines for "processing" by
clicking the Check Box.
The Check Box is a single dim variable (not an array).
I do not want to use an array of size X.
Since it's a single dim variable, it can hold only one value at
a time. So if I check one line, all the lines are checked.
How do I make the field behave like an "array?
i.e. each check box retains it's own value.
Sounds weird :)
But
. I had seen a solution for this a long time back on
baanfans.com
It had something to do with making the field type on the form
as "Input Only" and writing a 2 line code in the program script.
I am unable to find it this time.
I had tried it then. It worked just fine.
I do not have the session/script now - I quit that client.
The jerk that replaced me refuses to give me the solution :)
Thanks.
Cheers,
Madhu
NPRao
17th January 2002, 19:58
Hi,
I dont know which BaaN version you are using.
I used it long time ago and I do not have that sources anymore. you have the options called the depth/element for a form field, when you use that property you can use an array in the forms. I didnt require any additional programming for it.
I hope this gives you some clue to explore.
evesely
17th January 2002, 21:09
This doesn't directly answer your question, but could you use Baan's record marking (mark.occur) for choosing the lines and then execute some process based on the marked lines? Something like:
choice.cont.process:
on.choice:
for i = 1 to filled.occ
if mark.table(i) then
do.occ(i, function_name)
endif
endfor
Just an idea.
popeye
17th January 2002, 21:17
Hi Ed,
Thanks for your reply.
I did try that earlier.
Here is my problem with that solution.
I have 8 occs on the form.
I could have 40-50 records for processing.
With this solution, I can only process 8 of 'em at time.
(SHIFT + Mouse Click). Every time I try to mark more of 'em
the first 8 become "unmarked".
Please do let me know if you have another way to mark 'em
(other than CTRL/SHIFT + Mouse Click)
Thanks.
Cheers,
Madhu
NPRao
17th January 2002, 21:20
Hi,
I dont know your functionality. But you can use a specific option, "Change All Status" etc.
popeye
17th January 2002, 21:26
Hi NPRao,
Thanks for your post.
I want to select a sub set of the records for processing.
I do not want to process all the records - only the ones
selected by the user.
Also the user needs to process all the selected ones (could be
100 of 'em) at the same time - Not in batches of 8 (# of occs).
Also ... I do not to use "temp" tables etc.
Looking for a "clean" solution.
Thanks again for your posts.
Cheers,
Madhu
~Vamsi
17th January 2002, 22:18
Madhu,
I do not have a 2 line code. If you come across that, please share that with us. However here is the code that I posted to Baanfans sometime back.
~Vamsi
This is not Baan provided functionality. One has to code around it. And here is an example.
|* This program allows marking of non contiguous records into an array. This
|* array can be used for processing. It is possible to use the standard
|* marking methodology (Control + click), but I had to resort to the check-box
|* because the standard method was causing a few problems with my particular
|* case. If you want to switch to the standard selecting, please use the
|* choice.mark.occur sections instead of the field.check sections.
|* Assumption:
|* The main table has the primary index with one field.
|* What you want to do with the resulting array, is your choice :-).
|* Create the two messages that are used.
declaration:
table tttmmmnnn | main table for session
| This table has a one part index
| which is the field ttmmmnnn.ffff
#define DEPTH 100 | fixed number of records can be marked
| extend this functionality for more
| records to be marked.
long i, j
domain tcbool present.in.array
domain tcbool select.range
domain tcbool mark.range
domain tcbool unmark.range
domain tcbool first.record.selected
domain foo indexarray(DEPTH)
domain foo range.array(2)
| foo is the domain of the field
| ttmmmnnn.ffff
|form fields:
extern domain tcyesno check
| This is a multioccurence field which
| is the first field on each record.
| The user checks or unchecks this box
| to make selections.
extern domain tcmcs.long total.selections
| This field indicates the total number
| of selections made.
|****************************** program section *******************************
|****************************** form section **********************************
|****************************** choice section ********************************
choice.recover.set:
before.choice:
| I have been unable to fire this section when there have been no record changes.
| If anyone knows of a way of fooling the standard program into thinking that
| changes have taken place, please post the solution on the board.
| Thanks,
| ~Vamsi.
select.range = false
clean.mess()
| I added the below two sections for Baan IV. In BaanERP, the extern functions
| are linked directly to the form. And the usage of choice.user.n sections
| is discouraged.
| Link buttons to these choices.
choice.user.0:
before.choice:
mark.range.records()
choice.user.1:
before.choice:
unmark.range.records()
|******************************** field section *******************************
field.check:
before.display:
mark.occurence()
before.input:
mark.occurence()
when.field.changes:
if select.range then
if not first.record.selected then
first.record.selected = true
range.array(1, 1) = ttmmmnnn.ffff
mess("ttmmmnnnn2", 0)
|* Select the last record in range to (un)mark.
else
range.array(1, 2) = ttmmmnnn.ffff
on.main.table(mark.unmark.range)
endif
else
update.array()
endif
refresh()
display("total.selections")
... continued on the next post ...
~Vamsi
17th January 2002, 22:22
|******************************** functions ***********************************
functions:
function mark.occurence()
{
present.in.array = false
for i = 1 to total.selections
if indexarray(1, i) = ttmmmnnn.ffff then
check = tcyesno.yes
present.in.array = true
break
endif
endfor
if not present.in.array then
check = tcyesno.no
endif
}
function mark.unmark.range()
{
select ttmmmnnn.*
from ttmmmnnn
where ttmmmnnn._index1 inrange {:1}
and {:2}
wherebind(1, range.array(1, 1))
wherebind(2, range.array(1, 2))
selectdo
if mark.range then
check = tcyesno.yes
else
if unmark.range then
check = tcyesno.no
endif
endif
update.array()
endselect
select.range = false
clean.mess()
display.all()
}
function update.array()
{
|* Optimally, I would have liked to reuse the function mark.occurence().
|* Any one willing to help?
if check = tcyesno.yes then
present.in.array = false
if total.selections then
for i = 1 to total.selections
if indexarray(1, i) = ttmmmnnn.ffff then
present.in.array = true
break
endif
endfor
endif
if not present.in.array then
total.selections = total.selections + 1
indexarray(1, total.selections) = ttmmmnnn.ffff
endif
else
for i = 1 to total.selections
if indexarray(1, i) = ttmmmnnn.ffff then
for j = i to total.selections - 1
indexarray(1, j) = indexarray(1, j + 1)
endfor
indexarray(1, total.selections) = ""
total.selections = total.selections - 1
break
endif
endfor
endif
}
function extern long mark.range.records()
{
select.range = true
mark.range = true
unmark.range = false
first.record.selected = false
clean.mess()
mess("ttmmmnnnn1", 0)
|* Select the first record in range to (un)mark.
return(0)
}
function extern long unmark.range.records()
{
select.range = true
mark.range = false
unmark.range = true
first.record.selected = false
clean.mess()
mess("ttmmmnnnn1", 0)
|* Select the first record in range to (un)mark.
return(0)
}
|******************************** end of script ******************************