Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with checkbox

Former Member
0 Likes
1,209

hi expert,

i create report with check box at begin of write data in tab. after execute, i get report like this

1 (checkbox) xxxxx x xxx xxxxxxxxxxxxxxxx

2 (checkbox) xxxxx x xxx xxxxxxxxxxxxxxxx

3 (checkbox) xxxxx x xxx xxxxxxxxxxxxxxxx

4 (checkbox) xxxxx x xxx xxxxxxxxxxxxxxxx

when user select check box of desire line and press F8 button system will display only selected line.so i set check box default as 'X'.


Data:
  chk_box          type c value 'X',
  chk_box_val,


write:/1 1tab-xxxxx,
         30 chk_box as checkbox 

like this all checkbox in report is checked

so i will update field in 1tab to flag that this line is select. if user execute report and don't unmark, all line should display in second execute.

but it don't, nothing display. where is incorrect in my code? for easy to look, this is a relative part of code in my report.

 
at line-selection.
    perform selectline.
at pf8.
    perform printnewheader.
    perform printselectline.

form selectline.
  data xnum like rmtab-runno.
  read current line field value chk_box into chk_box_val.
  if chk_box_val is initial.
    chk_box_val = 'X'.
  else.
    chk_box_val = space.
  endif.

  modify current line field value chk_box from chk_box_val.
  if chk_box_val = 'X'.
    xnum = 1tab-runno.
    loop at 1tab where runno = xnum.
      1tab-chk = 'X'.
      modify 1tab.
      clear 1tab.
    endloop.
  else.
    xnum = 1tab-runno.
    loop at 1tab where runno = xnum.
      clear 1tab-chk.
      modify 1tab.
      clear 1tab.
    endloop.
  endif.
endform.             " selectline

form print-doc-select.
  loop at 1tab where chk = 'X'.

   write:/ ................
endform.

once i arrange code like this, but it's nothing

 
*at line-selection.
*    perform selectline.
at pf8.
    perform selectline.
    perform printnewheader.
    perform printselectline.

 (later is as same as above quote)


thank you in advance. point for good advise.

Regards,

Kittisak.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,171

Hi,

First remove the default value 'X'.

Bcoz,it will hold 'X' even if you dont check the chedcdkbox also.

After read ,the else condition is not needed.

Clear checkbox after modifying.

Edited by: Sreesudha Gullapalli on Feb 6, 2009 5:56 AM

9 REPLIES 9
Read only

Former Member
0 Likes
1,172

Hi,

First remove the default value 'X'.

Bcoz,it will hold 'X' even if you dont check the chedcdkbox also.

After read ,the else condition is not needed.

Clear checkbox after modifying.

Edited by: Sreesudha Gullapalli on Feb 6, 2009 5:56 AM

Read only

Former Member
0 Likes
1,171

Hi,

First tell if ur first screen should have all check boxes selected or plain.

Edited by: Sreesudha Gullapalli on Feb 6, 2009 5:57 AM

Edited by: Sreesudha Gullapalli on Feb 6, 2009 5:57 AM

Read only

0 Likes
1,171

to Sreesudha

all check box should check.

Read only

0 Likes
1,171

Problem solve. thank for all of your advise.

Read only

Former Member
0 Likes
1,171

HI,

First you have to describe the number of lines in list.TO do this

declare like this

And I modified your code. and dont mention the default value for check box.U can select dynamically by using the below code.It gives a good user interface. Based on the below code u can modify your code .Please check it out once...

data:

w_lines type i, " number of lines

w_linno type i. " line number

at line-selection.

perform selectline.

at pf8.

perform printnewheader.

perform printselectline.

form selectline.

data xnum like rmtab-runno.

describe list number of lines w_lines.

do w_lines times.

read current line w_lineno value chk_box into chk_box_val.

if chk_box_val is initial.

chk_box_val = 'X'.

else.

chk_box_val = space.

endif.

modify current line w_linno value chk_box from chk_box_val.

if chk_box_val = 'X'.

xnum = 1tab-runno.

loop at 1tab where runno = xnum.

1tab-chk = 'X'.

modify 1tab.

clear 1tab.

endloop.

else.

xnum = 1tab-runno.

loop at 1tab where runno = xnum.

clear 1tab-chk.

modify 1tab.

clear 1tab.

endloop.

endif.

clear chk_box .

add 1 to w_linno.

enddo.

endform. " selectline

form print-doc-select.

loop at 1tab where chk = 'X'.

write:/ ................

endform.

regards

Kiran

Edited by: Kiran Saka on Feb 6, 2009 5:50 AM

Read only

viquar_iqbal
Active Contributor
0 Likes
1,171

HI

In this code

form selectline.

data xnum like rmtab-runno.

read current line field value chk_box into chk_box_val.

if chk_box_val is initial.

chk_box_val = 'X'.

else.

chk_box_val = space.

endif.

you are changing the chkbox value to space so thats why its not excuting

if the value by default is X then there is no need to check the value of the checkbox

Hope this helps!

Thanks

Viquar Iqbal

Read only

Former Member
0 Likes
1,171

hi,

Can you explain more in detail? if you want to read all lines from the basic list or only the current line.i.e., the user selected line?

Read only

0 Likes
1,171

>

> hi,

>

> Can you explain more in detail? if you want to read all lines from the basic list or only the current line.i.e., the user selected line?

i want to read all line that check box at begin of line is checked , and display only lines that checked in 2nd Execute

I.E.

Zreport show 10 lines of data. check box at begin of line 2 , 3 , 4 , 8 is mark as checked by user. when user press execute again. report will show only line 2 ,3 ,4 , 8.

Read only

Former Member
0 Likes
1,171

Hi Kittisak ,

Please let me know first if you unmark or uncheck a few checkbox and then press F8 what is happenning ?

Regards

Pinaki