Link to home
Start Free TrialLog in
Avatar of Mateen
Mateen

asked on

Deleting column at runtime of a tabular datawindow.

Here is first few lines of a datawindow exported.

$PBExportHeader$dw_etlcoil2.srd
release 7;
datawindow(units=0 timer_interval=0 color=30457262 processing=0 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no )
header(height=160 color="536870912" )
summary(height=0 color="536870912" )
footer(height=104 color="536870912" )
detail(height=88 color="536870912" )
table(column=(type=char(8) update=yes updatewhereclause=yes key=yes name=trans_id dbname="etlcoil.trans_id" validation="len( gettext() )=8" validationmsg="'Item ~~'' +  gettext()  + '~~' length must be 8'" )
 column=(type=char(6) update=yes updatewhereclause=yes name=stpl_tag_no dbname="etlcoil.stpl_tag_no" )
 column=(type=char(15) update=yes updatewhereclause=yes key=yes name=etl_coil_id dbname="etlcoil.etl_coil_id" )
 column=(type=datetime update=yes updatewhereclause=yes key=yes name=etl_date dbname="etlcoil.etl_date" )
 column=(type=decimal(3) update=yes updatewhereclause=yes name=thick dbname="etlcoil.thick" initial="0" )
 column=(type=decimal(0) update=yes updatewhereclause=yes name=width dbname="etlcoil.width" initial="0" )
 column=(type=char(4) update=yes updatewhereclause=yes name=coat_id dbname="etlcoil.coat_id" initial="0001" validation="len( gettext() )=4" validationmsg="'Item ~~'' +  gettext()  + '~~' length must be 4'" )
 column=(type=decimal(4) update=yes updatewhereclause=yes name=weight dbname="etlcoil.weight" initial="0" )
 column=(type=char(6) update=yes updatewhereclause=yes key=yes name=shift dbname="etlcoil.shift" )
 column=(type=char(2) update=yes updatewhereclause=yes name=finish_id dbname="etlcoil.finish_id" )
 column=(type=decimal(2) update=yes updatewhereclause=yes name=temper dbname="etlcoil.temper" initial="0" )
 column=(type=char(10) update=yes updatewhereclause=yes name=grade dbname="etlcoil.grade" )
 column=(type=decimal(4) update=yes updatewhereclause=yes name=start_cuts dbname="etlcoil.start_cuts" initial="0" )
 column=(type=decimal(4) update=yes updatewhereclause=yes name=end_cuts dbname="etlcoil.end_cuts" initial="0" )
 column=(type=char(1) update=yes updatewhereclause=yes name=dup_tag dbname="etlcoil.dup_tag" initial="0" )
 column=(type=char(1) update=yes updatewhereclause=yes name=op_tag dbname="etlcoil.op_tag" initial="T" )
 column=(type=char(1) update=yes updatewhereclause=yes name=post_tag dbname="etlcoil.post_tag" )
 column=(type=char(40) update=yes updatewhereclause=yes name=defect dbname="etlcoil.defect" )
 column=(type=char(25) update=yes updatewhereclause=yes name=location dbname="etlcoil.location" )
 column=(type=char(1) update=yes updatewhereclause=yes name=mp dbname="etlcoil.mp" initial="N" values="Y      Y/N      N/" )
 column=(type=decimal(3) update=yes updatewhereclause=yes name=thick_to dbname="etlcoil.thick_to" initial="0" )
 column=(type=char(15) update=yes updatewhereclause=yes name=slit_id dbname="etlcoil.slit_id" )
 column=(type=char(15) update=yes updatewhereclause=yes name=lc_no dbname="etlcoil.lc_no" )
 column=(type=char(2) update=yes updatewhereclause=yes name=section_code dbname="etlcoil.section_code" )
 retrieve="  SELECT etlcoil.trans_id,  
         etlcoil.stpl_tag_no,  
         etlcoil.etl_coil_id,  
         etlcoil.etl_date,  
         etlcoil.thick,  
         etlcoil.width,  
         etlcoil.coat_id,  
         etlcoil.weight,  
         etlcoil.shift,  
         etlcoil.finish_id,  
         etlcoil.temper,  
         etlcoil.grade,  
         etlcoil.start_cuts,  
         etlcoil.end_cuts,  
         etlcoil.dup_tag,  
         etlcoil.op_tag,  
         etlcoil.post_tag,  
         etlcoil.defect,  
         etlcoil.location,  
         etlcoil.mp,  
         etlcoil.thick_to,  
         etlcoil.slit_id,  
         etlcoil.lc_no,  
         etlcoil.section_code  
    FROM etlcoil  
   WHERE ( ~"etlcoil~".~"trans_id~" = :ra_trans_no )  
     and ( op_tag = 'T' )  
" update="etlcoil" updatewhere=2 updatekeyinplace=yes arguments=(("ra_trans_no", string))  sort="etl_coil_id A " )
text(band=header alignment="2" text="Slit


I want to delete columns slit_id,lc_no,dup_tag,stpl_tag_no at runtime.
I don't want to change datawindow style that is processing=0 should not be changed.
How to do it.
Avatar of sajuks
sajuks

issue a destroy command
  dw_1.modify ("destroy slit_id")
  dw_1.modify ("destroy lc_no")
  dw_1.retrieve()
or you could do a SyntaxFromSQL( check in the help) and select only the fields that you want.
you can also use the destroy statement in a single line
  dw_1.modify ("destroy slit_id destroy ic_no")
just keep on adding the columns
Avatar of Mateen

ASKER

Hi sajuks

I wrote dw_1.modify ("destroy slit_id") in constructor event.

The column deleted but the heading above remains and there and the form did not adjust accordingly.


You need to delete the header text in the same way, Also to adjust the width is another pain.
i'd recommend using the SyntaxFromSQL function.Check in the help file for a detailed answer/
Avatar of Mateen

ASKER

If I use syntaxfromsql() and remove unwanted columns, then, will the form  be adjusted accordingly.
Will it also delete the related headings(text just above the column).
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mateen

ASKER

Ok, sajuks.
I would sort it out and let u know.

Thanks
Mateen,

"I wrote dw_1.modify ("destroy slit_id") in constructor event.
The column deleted but the heading above remains and there and the form did not adjust accordingly."

You will also need to delete the column header object explicitly
dw_1.modify ("destroy slit_id_t")

Also, you need to move the objects explicitly.. So overall sajuks suggestion of having two DWs looks good.
If it was grid style, everything would have been ok..

Regards,
Vikas Dixit
Avatar of Mateen

ASKER

Hi vikas:

I just asked the question if it could be done for tabular DW. I would try to sort it out first by
using syntaxfroxsql and if not succeeded then by changing tabular to grid. Can I, in grid dw, copy and paste column and
rename the pasted column and associate drop down datawindow the same way as in tabular Dw. (I have not tried yet).


Now the following commen is made in most humble manner. (Please ignore it If I am not good).
Actually, there are four users, for them basics are same, and a few columns are needed by one and not by another.
If I make more than one DW and if any change/refinements is made on basics then I will have to do the same on all dws.

Mateen:




You could try using the hide show ( visisble) property of the datawindow.
Place once column above the another. If user1 views then show column A else show column B.
Grid datawindow wpuld be able to do change the ddw but dont think that copy and paste column will work. havent tried it.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial