[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Deleting column at runtime of a tabular datawindow.

Posted on 2004-12-01
11
Medium Priority
?
1,646 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:Mateen
  • 5
  • 4
  • 2
11 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 12714144
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.
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12714167
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
0
 

Author Comment

by:Mateen
ID: 12714342
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.


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 33

Expert Comment

by:sajuks
ID: 12714386
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/
0
 

Author Comment

by:Mateen
ID: 12714512
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).
0
 
LVL 33

Accepted Solution

by:
sajuks earned 1000 total points
ID: 12714559
did you check the example in the help file. You are recreating the existing dataobject by including only the fields you need.
Since your whole select is changing then the gaps wont be there would it ?
If you frequently use this window then wouldnt it be better to create a copy of the existing dataobejct ( excluding the undesired fields ) ?
There is one more way that you could do this, thats by setting the visible property to false based on some condition in the dataobejct itself.There you could then mark the fields to slide left so taht the gaps are filled up.But  i really would suggest creating another dataobject or recreating the sql as the above cant be guaranteed to slide perfectly on all machines.(i used to 've this problem on one machine,windows xp might've been something else but was never able to figure it out )
0
 

Author Comment

by:Mateen
ID: 12714873
Ok, sajuks.
I would sort it out and let u know.

Thanks
0
 
LVL 8

Expert Comment

by:Vikas_Dixit
ID: 12720679
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
0
 

Author Comment

by:Mateen
ID: 12723168
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:




0
 
LVL 33

Expert Comment

by:sajuks
ID: 12723198
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.
0
 
LVL 8

Assisted Solution

by:Vikas_Dixit
Vikas_Dixit earned 1000 total points
ID: 12723425
Not sure what Copy and Paste Column means.. Never tried that... But associating DDDW will surly work..

Sajuks option of hide/show is good if you have mutually exclusive columns to show(for user 1 show A, for user 2 show B).

Another option may be to change the position of colums that are not basic, at end, so that you can Just Delete them, But not sure if it will acceptable to the users.

If it's a single DW, then you have to move the Colum ( and their header positions) explicitly. You can do it in script, instead of doing in the Syntax. This algorithm may be of some help( not PB code)

A B C D E F G H I ( Column list)
A C D E G I  ( colums B, F , H deleted):

//Before destroying the columns, Correct positions of other columns.
integer li_shift =0// How much each col to shift.
for column in A to I
  column.x= column.x - li_shift
  if column to be destroyed then  li_shift = li_shift + column.width (and + space between the columns, if any)
next

//Now procees to destroy the columns.

Regards,
Vikas Dixit

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question