Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataWindow Questions

Status
Not open for further replies.

Statey603

Programmer
Nov 10, 2009
196
US
I am looking at a Datawindow that someone else created.

It looks like the SQL behind the Datawindow has some db fileds that are not necessary.

Is there a way to get a list of the data fields that are used on the DataWindow layout?

Does the Column Specification just list all fields in the SQL?

thanks
 
You can export the dw object and look at it in an editor or use the 'view source' option (depending on what version of PB you are using). The text will have a section with the SQL and another section with a series of 'column' values. These are the ones used in the layout of the dw. You will want to make sure the 'unused' columns are not part of an expression.

Matt

"Nature forges everything on the anvil of time
 
Hi Matt,

That sounds perfect.

How do I export the dw object?

You aren't talking about the Export/Import Template that I see below the Layout are you? I have looked at that and it does not seem to provide the info that you mention unless I am misunderstanding.

Sorry to be asking so many questions. PowerBuilder is so new to me.

I appreciate the assistance.

- Bill
 
OK.....
I found my way to the Source and was able to locate the SQL and the Column data.

I found items listed in the Column data that are not visible anywhere on the DataWindow layout. The items that I cannot locate appear to be checkboxes or some kind of conditional formatting.

Here is some Source:

// The next 2 items ARE visible on the Datawindow layout.
column=(type=char(2) updatewhereclause=yes name=ind_tbl_mail_state_cde dbname="ind_tbl.mail_state_cde" )

column=(type=char(10) updatewhereclause=yes name=ind_tbl_mail_zip_code_nbr dbname="ind_tbl.mail_zip_code_nbr" )


// the next 3 items are NOT visible on the DataWindow layout. I believe these are/were checkboxes or conditional.

// Why wouldn't I be able to see these in the DW layout?
// Is there somewhere else I can look in the Source to see if these items are actually used?
//Could they just have a property set to not visible or something stupid like that?

column=(type=char(1) updatewhereclause=yes name=i_dtl_tbl_elig_dt_ind dbname="i_dtl_tbl.elig_dt_ind" values="Approved Y/Approved N" )

column=(type=char(1) updatewhereclause=yes name=i_dtl_tbl_instate_ind dbname="i_dtl_tbl.instate_ind" values="In-State Y/In-State N" )

column=(type=char(1) updatewhereclause=yes name=i_dtl_tbl_exam_ind dbname="i_dtl_tbl.exam_ind" values="Exam Taken Y/Exam Taken N" )


 
On the actual lay out of the dw, are these items off the visible portion of the screen or under one of the bands? (move the detail band down)

Matt

"Nature forges everything on the anvil of time
 
hello Bill

In a datawindow you normaly define a Select that goes "behind it" (hit the 'sql' button). (I think you found that part).
The columns of the select apear in the column list. It's not necesary that they also are visible in the datawindow. For example you could create a datawindow that has 3 columns in its select and then delete the columns in the design. From code you can still access those columns.

Other 'columns' might appear since you have the possibility of inserting 'computed columns'. they are used very often and allow you to create a result, based on other columns and expressions. Menu: 'insert', 'control', 'computed field'. (or using the icon '+/-')

if you use a 'higher' version of pb there should be some tabs saying 'column specification' (the columns of the select) and another one saying 'control list' (the columns and computes, etc. that are present on the design layout of the dw (the 'visible' ones). If you don't see those tabs, then go to the menu 'view', 'layouts' and choose the default layout.

I quote:
--------
// the next 3 items are NOT visible on the DataWindow layout. I believe these are/were checkboxes or conditional.
// Why wouldn't I be able to see these in the DW layout?
-- maybe they have been deleted or they can be below a band or with a far 'x' coordinate. if they are deleted they still can be read from code as long as they are present in the select.

// Is there somewhere else I can look in the Source to see if these items are actually used?
-- since a datawindow can be used anywhere and there can be references to its columns anywhere. You'll have to do a search using the name of the datawindow to find all objects using your datawindow. then, you'll have to check each one of them to see if they use certain columns or not. There's no way PB will give a compiler error for lack of a column. You have to do a search to make sure nothing is using an 'unwanted' column. (there are some tools, but a search on top of your target with right mouse button (from the library painter), normally gives you all ocurences.

sorry for the lousy spelling, I'm dutch-spanish


//Could they just have a property set to not visible or something stupid like that?
-- yes columns have a property 'visible' but you will see the column in design mode, even if its visible attribute is put to '0' (not visible).

Hope it helps. Datawindows are great but




regards,
Miguel L.
 
... finishing previous message:

... but there is lot to know. I think there's a book dedicated to datawindows that might help you out, though this is the fastest way of learning: "Just do it" hahaha


regards,
Miguel L.
 
OK.....

Thanks for the comments & clarifications.

So it looks like there is no easy way to determine if fields in the SQL are used by the datawindow. If the field is not on the Datawindow layout, it still might be used so I will need to check in the code.

What it looks like is that whoever designed these started with a pretty complex Datawindow/SQL and then duplicated it and never bothered to remove the unused fields. These Datawindows were for future development which is what I am working on now. I don't believe many of these ever worked because there are issues with the SQL. So my first thought is to eliminate unused data from the SQL.

With this new information, it looks like I need to delve deeper to make determine if the SQL data is used or not. It is not as simple as seeing if it is on the Datawindow layout.

thanks




 
there's a utility called "advanced utilities", that has a part of "crossreference" (previously came with the of previous versions and I think they're available for download from In "options" include everything (scripts included) and once it has generated it's database, you can 'View', 'unreferenced objects'. That way you might clean up a little bit.
It doesn't show unused columns, but a good start would be to clean up unused datawindows.

then there's another (also free) utility pbl-peeper from techno-kitten that will generata a report with information about "columns being used where" and that sort of information. Might come in very handy for what you are doing.
Just drag your libraries to the right pane, set your report options and click the "go" button (on the right-down corner on the screen).


regards,
Miguel L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top