How could I create a Gantt-like chart in a datawindow (Powerbuilder) - sybase

I want a rather simple (and cheap) solution, just for presentation purposes (and just to show the task duration bars - no connection lines between them). So, I am not interested in buying some advanced custom control like this for example. Have any of you ever used something like this? Are there any code samples available?

I would have pointed to Buck Woolley's dwExtreme site for an example of how to do a gantt in native DataWindow. However, "simple" I don't think is in your future if you want to roll your own. In fact, I'll be pleasantly surprised if someone writes a posting that includes a full description; I think it would take pages. (I'd be happy if someone proved me wrong.) In the meantime, here are some DataWindow basics I think you would need:
You can create an external DataWindow whose data source is not tied to a table
Columns in the data set do not have to be shown on the user interface
Columns in the data set can be used in expressions to evaluate attributes, so you could have a column for each of the following attributes of a rectangle:
x
width
color
I'd expect this to be a lot of work and time, and very likely to be worth the purchase the component (unless your time is valued at next to nothing, which in some IT shops is close to true).
Good luck,
Terry

(source: illudium.com)
You can make a simple Gantt chart with a Stacked Bar Graph (BarStacked (5) in the painter). The trick is to create a dummy series to space the bar out where you want it and make the dummy bar the same color as the graph's background (BackColor). It turns out you also need another dummy series with a small value to sit on the axis. Otherwise when you change the color of the bar that's doing the spacing, the axis line gets cut off. I found that .04 works well for this value.
Create the DataWindow
(This assumes familarity with the DataWindow Wizard. Refer to the PowerBuilder User's Guide for more information on creating graphs in DataWindows)
Click the icon for the new object wizard. Create a Graph DataWindow with an External data source. Create columns task type string(20), ser type string(1), and days type number. Set the Category to the task column and the Values to the days column. Click the Series button and select ser for the series. Don't bother with the title, and select the Stacked Bar graph type. When the painter opens, save the DataWindow. On the General tab in the Painter, change the Legend to None (0). On the Axis tab, select the Category axis, then set the sort to Unsorted (0). Select the Value axis then set the sort to Unsorted (0). Select the Series axis and set the sort to Ascending (1). Save the DataWindow.
Create the Window
Create a window and place a DataWindow control, dw_1. Set the data object to your graph DataWindow. Place the following in the open event (or pfc_postopen if using PFC).
try
dw_1.setRedraw(FALSE)
// LOAD DATA HERE
dw_1.object.gr_1.title = 'Project PBL Pusher'
dw_1.object.gr_1.category.label = 'Phase'
dw_1.object.gr_1.values.label = 'Project-Days'
catch (runtimeerror re)
if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text) // could do better
finally
dw_1.setRedraw(TRUE)
end try
You would load the data for your chart where the comment says // LOAD DATA HERE
Script the graphcreate Event
Add an new event to dw_1. Select pbm_dwngraphcreate for the Event ID. I like to name these events by removing the pbm_dwn prefix so I use graphcreate. Add the following code to the event.
string ls_series
long li_color
try
li_color=long(dw_1.object.gr_1.backcolor)
// note first series is a dummy with a small value (0.04 seems to work) to keep the line from being hidden
ls_series = dw_1.seriesName("gr_1", 2)
if 0 = len(ls_series) then return // maybe show error message
// will return -1 when you set color same as the graph's backcolor but it sets the color
dw_1.setSeriesStyle("gr_1", ls_series, BackGround!, li_color) // the box
dw_1.setSeriesStyle("gr_1", ls_series, ForeGround!, li_color) // the inside
catch (runtimeerror re)
if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text) // could do better
end try
Data for the Graph
Load the data with the categories in the reverse order of what you want. For each Task, insert 3 rows and set the series to a, b, and c, respectively. For series a in each task, set a small value. I used 0.04. You may have to experiment. For series b in each task, set the number of days before start. For series c, set the number of days. Below is the data in the sample DataWindow.
Task Ser Days
---- --- ----
Test a 0.04
Test b 24
Test c 10
Develop a 0.04
Develop b 10
Develop c 14
Design a 0.04
Design b 0
Design c 10
Sample DataWindow
Below is the source for a sample DataWindow in export format. You should be able to import into any version >= PB 10. Copy the code and paste it into a file with an SRD extension, then import it.
HA$PBExportHeader$d_graph.srd
release 10;
datawindow(units=0 timer_interval=0 color=1073741824 processing=3 HTMLDW=no print.printername="" print.documentname="" print.orientation = 1 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=0 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=task dbname="task" )
column=(type=char(1) updatewhereclause=yes name=ser dbname="ser" )
column=(type=number updatewhereclause=yes name=days dbname="days" )
)
data("Test","a", 0.04,"Test","b", 24,"Test","c", 10,"Develop","a", 0.04,"Develop","b", 10,"Develop","c", 14,"Design","a", 0.04,"Design","b", 0,"Design","c", 10,)
graph(band=background height="1232" width="2798" graphtype="5" perspective="2" rotation="-20" color="0" backcolor="16777215" shadecolor="8355711" range= 0 border="3" overlappercent="0" spacing="100" plotnulldata="0" elevation="20" depth="100"x="0" y="0" height="1232" width="2798" name=gr_1 visible="1" sizetodisplay=1 series="ser" category="task" values="days" title="Title" title.dispattr.backcolor="553648127" title.dispattr.alignment="2" title.dispattr.autosize="1" title.dispattr.font.charset="0" title.dispattr.font.escapement="0" title.dispattr.font.face="Tahoma" title.dispattr.font.family="2" title.dispattr.font.height="0" title.dispattr.font.italic="0" title.dispattr.font.orientation="0" title.dispattr.font.pitch="2" title.dispattr.font.strikethrough="0" title.dispattr.font.underline="0" title.dispattr.font.weight="700" title.dispattr.format="[general]" title.dispattr.textcolor="0" title.dispattr.displayexpression="title" legend="0" legend.dispattr.backcolor="536870912" legend.dispattr.alignment="0" legend.dispattr.autosize="1" legend.dispattr.font.charset="0" legend.dispattr.font.escapement="0" legend.dispattr.font.face="Tahoma" legend.dispattr.font.family="2" legend.dispattr.font.height="0" legend.dispattr.font.italic="0" legend.dispattr.font.orientation="0" legend.dispattr.font.pitch="2" legend.dispattr.font.strikethrough="0" legend.dispattr.font.underline="0" legend.dispattr.font.weight="400" legend.dispattr.format="[general]" legend.dispattr.textcolor="553648127" legend.dispattr.displayexpression="' '"
series.autoscale="1"
series.displayeverynlabels="0" series.droplines="0" series.frame="1" series.label="(None)" series.majordivisions="0" series.majorgridline="0" series.majortic="3" series.maximumvalue="0" series.minimumvalue="0" series.minordivisions="0" series.minorgridline="0" series.minortic="1" series.originline="1" series.primaryline="1" series.roundto="0" series.roundtounit="0" series.scaletype="1" series.scalevalue="1" series.secondaryline="0" series.shadebackedge="0" series.dispattr.backcolor="536870912" series.dispattr.alignment="0" series.dispattr.autosize="1" series.dispattr.font.charset="0" series.dispattr.font.escapement="0" series.dispattr.font.face="Tahoma" series.dispattr.font.family="2" series.dispattr.font.height="0" series.dispattr.font.italic="0" series.dispattr.font.orientation="0" series.dispattr.font.pitch="2" series.dispattr.font.strikethrough="0" series.dispattr.font.underline="0" series.dispattr.font.weight="400" series.dispattr.format="[general]" series.dispattr.textcolor="0" series.dispattr.displayexpression="series" series.labeldispattr.backcolor="553648127" series.labeldispattr.alignment="2" series.labeldispattr.autosize="1" series.labeldispattr.font.charset="0" series.labeldispattr.font.escapement="0" series.labeldispattr.font.face="Tahoma" series.labeldispattr.font.family="2" series.labeldispattr.font.height="0" series.labeldispattr.font.italic="0" series.labeldispattr.font.orientation="0" series.labeldispattr.font.pitch="2" series.labeldispattr.font.strikethrough="0" series.labeldispattr.font.underline="0" series.labeldispattr.font.weight="400" series.labeldispattr.format="[general]" series.labeldispattr.textcolor="0" series.labeldispattr.displayexpression=" seriesaxislabel" series.sort="1"
category.autoscale="1"
category.displayeverynlabels="0" category.droplines="0" category.frame="1" category.label="(None)" category.majordivisions="0" category.majorgridline="0" category.majortic="3" category.maximumvalue="0" category.minimumvalue="0" category.minordivisions="0" category.minorgridline="0" category.minortic="1" category.originline="0" category.primaryline="1" category.roundto="0" category.roundtounit="0" category.scaletype="1" category.scalevalue="1" category.secondaryline="0" category.shadebackedge="1" category.dispattr.backcolor="556870912" category.dispattr.alignment="1" category.dispattr.autosize="1" category.dispattr.font.charset="0" category.dispattr.font.escapement="0" category.dispattr.font.face="Tahoma" category.dispattr.font.family="2" category.dispattr.font.height="0" category.dispattr.font.italic="0" category.dispattr.font.orientation="0" category.dispattr.font.pitch="2" category.dispattr.font.strikethrough="0" category.dispattr.font.underline="0" category.dispattr.font.weight="400" category.dispattr.format="[general]" category.dispattr.textcolor="0" category.dispattr.displayexpression="category" category.labeldispattr.backcolor="556870912" category.labeldispattr.alignment="2" category.labeldispattr.autosize="1" category.labeldispattr.font.charset="0" category.labeldispattr.font.escapement="900" category.labeldispattr.font.face="Tahoma" category.labeldispattr.font.family="2" category.labeldispattr.font.height="0" category.labeldispattr.font.italic="0" category.labeldispattr.font.orientation="900" category.labeldispattr.font.pitch="2" category.labeldispattr.font.strikethrough="0" category.labeldispattr.font.underline="0" category.labeldispattr.font.weight="400" category.labeldispattr.format="[general]" category.labeldispattr.textcolor="0" category.labeldispattr.displayexpression="categoryaxislabel" category.sort="0"
values.autoscale="1"
values.displayeverynlabels="0" values.droplines="0" values.frame="1" values.label="(None)" values.majordivisions="0" values.majorgridline="0" values.majortic="3" values.maximumvalue="1500" values.minimumvalue="0" values.minordivisions="0" values.minorgridline="0" values.minortic="1" values.originline="1" values.primaryline="1" values.roundto="0" values.roundtounit="0" values.scaletype="1" values.scalevalue="1" values.secondaryline="0" values.shadebackedge="0" values.dispattr.backcolor="556870912" values.dispattr.alignment="2" values.dispattr.autosize="1" values.dispattr.font.charset="0" values.dispattr.font.escapement="0" values.dispattr.font.face="Tahoma" values.dispattr.font.family="2" values.dispattr.font.height="0" values.dispattr.font.italic="0" values.dispattr.font.orientation="0" values.dispattr.font.pitch="2" values.dispattr.font.strikethrough="0" values.dispattr.font.underline="0" values.dispattr.font.weight="400" values.dispattr.format="[General]" values.dispattr.textcolor="0" values.dispattr.displayexpression="value" values.labeldispattr.backcolor="553648127" values.labeldispattr.alignment="2" values.labeldispattr.autosize="1" values.labeldispattr.font.charset="0" values.labeldispattr.font.escapement="0" values.labeldispattr.font.face="Tahoma" values.labeldispattr.font.family="2" values.labeldispattr.font.height="0" values.labeldispattr.font.italic="0" values.labeldispattr.font.orientation="0" values.labeldispattr.font.pitch="2" values.labeldispattr.font.strikethrough="0" values.labeldispattr.font.underline="0" values.labeldispattr.font.weight="700" values.labeldispattr.format="[general]" values.labeldispattr.textcolor="0" values.labeldispattr.displayexpression="valuesaxislabel" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
xhtmlgen() cssgen(sessionspecific="0" )
xmlgen(inline="0" )
xsltgen()
jsgen()
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
export.xhtml()

Related

viewcriteria is not working for data having word "and"

i am working with applying view criteria programaticlly, till now it was fine, but when i searched with "develop and unit test" it is showing 0 records even though my table having data. iam using like operator. could any one help on this .
i have one table, having option to filter by providing select combo box list of vales, for every column when i select any thing in lov in value change listener i am applying viewcriteria programatically on table vo.
note. every thing is programatic view object only there is no point of entity, or sql
Sample Code:
DCIteratorBinding bindIterator = ADFUtils.findIterator("Tri2EWS_ETKAPIData_VO1Iterator");//Table viewObject(programatic)
Tri2EWS_ETKAPIData_VOImpl voimpl = (Tri2EWS_ETKAPIData_VOImpl) bindIterator.getViewObject();
ViewCriteria viewCriteria = voimpl.createViewCriteria();
viewCriteria.setName("MyVc");
ViewCriteriaRow viewCriteriaRow = viewCriteria.createViewCriteriaRow();
viewCriteriaRow.setOperator("ViewAttr1", "LIKE");
viewCriteriaRow.setAttribute("ViewAttr1", "stack and OverFlow");
viewCriteria.add(viewCriteriaRow);
viewCriteria.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
voimpl.applyViewCriteria(viewCriteria, true);
voimpl.executeQuery();
voipmpl.getRowCount();//Getting 0 here (Actually i should get 1)
Turn on debug messages for ADF BC (jbo.debugoutput) so you can see the SQL that is being generated.
This will help you figure out if the query is correctly formatted.

-ADVICE REQUEST- MS-ACCESS Hyperlink Comparison Script Advice

I'm brand new to MS-Access and had a few guideline-questions,
My organization uses MS-Access to track a large electronic-part inventory. These parts have a hyperlink field that links to the product webpage. Here's an example:
Part Number Part Type Value Description Component_Height Voltage Tolerance Schematic Part Layout PCB Footprint Manufacturer Part Number Manufacturer Distributor Part Number Distributor Price Availability Link
UMK105CG100DV-F Ceramic 10pF CAP CER 10PF 50V NP0 0402 0.35 MM 50V ±0.5pF xxxxx\C_NP,xxxxx\C_NP_Small c_0402 UMK105CG100DV-F Taiyo Yuden 587-1947-2-ND Digi-Key 0.00378 In Stock http://www.digikey.com/product-detail/en/UMK105CG100DV-F/587-1947-2-ND/1473246
Links Here:
http://www.digikey.com/product-detail/en/UMK105CG100DV-F/587-1947-2-ND/1473246
Nearly the entire majority of our hyperlinks point to the supplier DigiKey.
Right now the verification flow goes like this:
Every month or so a large group of us sits down and one by one copies the hyperlink into google.
We then open the corresponding webpage and verify component availability etc.
We have nearly 1000 components and this process takes hours. All I'm looking for is advice on how to improve our workflow. I was hoping there was say a way to write a "open hyperlink with default browser and search string" macro or scripting interface. The pseudo-script would then check that the string "Quantity Available" was greater than 1, and if it wasn't (the part was out of stock) mark the part as obsolete.
Any advice would be greatly appreciated, I'm really aiming to optimize our workflow.
You can traverse the DOM of the web page. A quick look at the web page and you can see a table with a name of product-details.
So the following VBA code would load the sample web page, and pull out the values.
Option Compare Database
Option Explicit
Enum READYSTATE
READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4
End Enum
Sub GetWebX()
Dim ie As New InternetExplorer
Dim HTML As New HTMLDocument
Dim strURL As String
Dim Htable As New HTMLDocument
Dim i As Integer
strURL = "http://www.digikey.com/product-detail/en/UMK105CG100DV-F/587-1947-2-ND/1473246"
ie.Navigate strURL
Do While ie.READYSTATE < READYSTATE_COMPLETE
DoEvents
Loop
Set HTML = ie.Document
Set Htable = HTML.getElementById("product-details")
For i = 0 To Htable.Rows.Length - 1
With Htable.Rows(i)
Debug.Print Trim(.Cells(0).innerText), Trim(.Cells(1).innerText)
End With
Next I
ie.Quit
Set ie = Nothing
End Sub
output of above:
Digi-Key Part Number 587-1947-2-ND
Quantity Available 230,000
Can ship immediately
Manufacturer Taiyo Yuden
Manufacturer Part Number UMK105CG100DV-F
Description CAP CER 10PF 50V NP0 0402
Expanded Description 10pF ±0.5pF 50V Ceramic Capacitor C0G, NP0 0402(1005 Metric)
Lead Free Status / RoHS Status Lead free / RoHS Compliant
Moisture Sensitivity Level (MSL) 1 (Unlimited)
Manufacturer Standard Lead Time 11 Weeks
Since the above is a array, then you could place a button right on the form, and have a few extra lines of VBA to write the values into the form. So a user would just have to go to the given record/form in Access - press a button and the above values would be copied right into the form.
the above VBA code requires a reference to:
Microsoft Internet Controls
Microsoft HTML Object Library
I would suggest that after testing you use late binding for the above two libraries.

How to add several rows for each item for a ListBox in winform

I have a collection with 50 objects.
Each object contains several things but we have at least
OrgNr, Register_Id, Name, MailDate, Subject
for each object.
Assume these have the following values
OrgNr = "2556745-8145"
Register_Id = "1001"
Name = "Thailaan Asian Market"
MailDate = "2016-05-23 13:01:20"
Subject = "LPP failure"
So when I read the first object and want to add the above five fields to the ListBox I want it to be displayed like this and as one column.
2556745-8145/1001
Thailaan Asian Market
2016-05-23 13:01:20
LPP failure
So all these five fields is like one item and should be clickable.
I have been looing everywhere but the only example I have found is this
http://www.codeproject.com/articles/2695/an-editable-multi-line-listbox-for-net.
I can't use this example because I want to be able to control when I want to add CR LF which is after each written field value
//Tony

Manipulate SQL Server spatial data

I have a table containing a map. The data looks like this
select
location.ToString()
from
mp_ices_areas
where
ICES_AREA in ('IIIa', 'IVa', 'IVb')
results in this:
POLYGON ((11.45850012 58.98790008, 11.4651 58.98660003, ...
POLYGON ((7.00000056 58.05548352, 7.00010064 58.05550053, ...
etc.
The map have been updated, so the "step looking" border is now a straight line. This is visualized using this query:
DECLARE #g1 geography = 'LINESTRING (7.0480147 57.982986, 8.598667 57.112833)';
select
location.STUnion(#g1)
from
mp_ices_areas
where
ICES_AREA in ('IIIa', 'IVa', 'IVb')
Original map with new border line
The result should be like this:
Corrected map
What needs to be done:
If you look at the first picture then the border beween the three areas (blue, purple and orange) looks like a staircase.
The areas needs to be changed so that this border between these three areas follows the thin red line instead (I tried to visualize the wanted result in the last picture).
I have coordinates of the red line (start and end point), so it must be possible somehow to make some SQL that could either update the geography object or help me manually create a new WKT string.

OxyPlot : ColumnSeries/BarSeries display value of each column

In my WPF app, I use OxyPlot. I bind my data to the PlotModel and all is working well.
I want to display the value of each column on the chart. Is it possible?
For reference, this example of BarSeries on site, I wish to show actual value of Apples of 2009, 2010 & 2011 respectively on each column. i.e. value of Value1 for the 2009Apples column, Value2 for 2010Apples and so on.
I looked up at the APIof the BarSeries (For WPF ColumnSeries used interchangeably).
Tutorials of Bar & other plots. But couldn't find such thing anywhere.
How do I achieve this?
Yes, just set the LabelFormatString property of your series.
var theSeries = new ColumnSeries();
theSeries.LabelFormatString = "{0:F2}"; // Example: 1.2311 will display like "1.23"
// Add your columns
theSeries.Items.Add(new ColumnItem(someValue);
// ...
There is also an optional property you can set called LabelPlacement. The default value is LabelPlacement.Outside:
theSeries.LabelPlacement = LabelPlacement.Middle;

Resources