PowerBuilder 5.0 datastores

PowerBuilder 5.0 datastores

Question:
I am 90 percent done building a product catalog using PB 5.0.2 and SQL Anywhere 5.5.

I just added a feature that uses a datastore to retrieve pricing information and update an onscreen datawindow. Here’s an excerpt:

datastore lds_datastore	…	lds_datastore = CREATE datastore	lds_datastore.DataObject = “d_price”	// Assign SQL here	lds_datastore.SetTransObject(SQLCA)	…	lds_datastore.Retrieve (ls_item_nbr)	// Fetch a price	ls_price = lds_datastore.GetItemDecimal(1,1)		dw_results_window.SetItem(ll_row,”suggest_retail_price”,ls_price)	…	DESTROY lds_datastore
This works great on my development box, but when I deploy I get the error “Application terminated. Error: Datawindow column type doesn’t match Getitem type.”

I can simulate this in development by changing the DataObject to d_prices, so it seems to me that PB can’t find the d_prices datawindow in the runtime library on the deployed box.

I optimized and rebuilt the runtime library and the executable, but still no luck…

Answer:
I think your diagnosis is correct: PowerBuilder cannotfind the Datawindow object at runtime, so it gives you the error you describe.

This is normally caused by PowerBuilder not including the Datawindowobject in your executable. When PowerBuilder builds your executable, it tries to beclever and checks recursively the PBLs for all the objects that arereferenced by the application. Because your datawindow is referenced by astring d_price, PowerBuilder does not realize there is a reference tothat object and thus does not include it in your executable.

To solve this problem you need to create a PBR (PowerBuilderResource) file, which enables you to tell PowerBuilder to include anobject it wouldn’t normally include. These can include bitmaps, icons and datawindows.

Create a file and add the following entry:

my_pbl.pbl(d_price)
where my_pbl is replaced with the library name where d_price is located.Then add the PBR file to the .exe resource file in the project painterand rebuild your executable.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several