It’s a pretty typical situation where you want to know the value displayed in a dropdown datawindow even though behind the scenes only the ID is saved. Here is a technique you can use to look up the value in any row in the datawindow. ls_describe = “Evaluate(‘LookUpDisplay(part_id)’, ” + string(ll_found) + “)”//ll_found is the…
You are currently browsing the Programming category
PowerBuilder – Lookup the Display value of a DDDW column
Comment on PowerBuilder – Lookup the Display value of a DDDW column »
PowerBuilder – Change Background of Modified Columns in Datawindow
Okay so you have a datawindow with a bunch of rows which can be edited (a grid datawindow is a good choice). So when the user pulls up the data set and proceeds to change values in a variety of columns and a variety of rows you want to indicate to him that the specific…
PowerBuilder – Simple ‘Windows Standard’ Row Selection
Allowing for ‘Windows Standard’ muli row selection is pretty straight forward. By ‘Windows Standard’ I mean you can select a range by clicking on a row, holding the shift key and clicking on a second row to select all the rows between the two or by holding down the control key and clicking you can…
Powerbuilder – Evaluating Arithmetic Expressions
Below is a function which allows the user to enter an arithmetic expression and then evaluate it and return the result. This will work for addition (+), subtraction(-), multiplication(*), division(/), and exponentiation(^). You can also enter parenthesis to change the order of precedence if needed. You would call this from where ever you like to…
PowerBuilder – Populate a dropdownlistbox from a SQL statement
Here is a method to populate a dropdownlistbox control with values from a sql statement. Since it is based on a datastore you can easily apply filters, sorts, etc. prior to populating the dropdownlistbox with values. The code assumes the first column in the SQL is going to be used to populate the dropdownlistbox .…
PowerBuilder – ‘Smart’ Crosstab Datawindow
I had a question from a co-worker regarding a functionality request from a user. Basically they wanted a datawindow to display information for vendors (basic stuff like name, amt 1, amt 2, amt 3, etc.) for a specific set of amount columns. Each line represents one vendor and the various amounts (if any) with a…
Look what I found
Work long enough as a programmer and you will no doubt find something in the source code which is a) unintelligible b) ridiculous c) very funny. This category is devoted to these things. Found in a stored procedure: {lots of stuff went on before this point} —- Begin Actual code —- commit; –We will probably…
Create Word Doc and attach to Outlook Email in PowerBuilder
Here is some sample PowerScript from back in 2004. The word document created is saved from a template doc previously created with specific bookmarks used to format the text. oleobject lole_word OLEObject lole_item, lole_attach, lole_outlook string ls_file_name lole_word = CREATE oleobject lole_outlook = Create OLEObject TRY lole_word.connecttonewobject('word.application') CATCH (runtimeerror a) Messagebox('Error','Error connecting with MS Word.…