Skip to Content
0
Former Member
Jul 15, 2013 at 08:03 PM

Calling PowerBuilder.NET Assembly From a C# Assembly Always Returns Null or Empty String

179 Views

I have a C# assembly that is calling a PowerBuilder.NET(12.1 Build 7217) assembly. The PowerBuilder source code is contained below, you can see it is a rather simple true/false evaluation of a string.

When the PB.NET assembly is called by a Window in C#, it returns the expected result of "true". When the same code is called by a C# assembly, the code returns "", or an empty string.

I have managed to narrow the problem down to the DataStore interactions in the PB.NET assembly. If the PB.NET assembly is called from another assembly, the DataStore always has 0 rows and contains only empty strings. Has anyone seen or dealt with this before?

// Create instance of Datastore

ldsExpression = CREATE DataStore

// Set data object

ldsExpression.DataObject = "d_condition_expression"

//// Setting datawindow expression

lsExpression = 'condition_expression.expression = ~"' + asConditionExpression + '~"'


//// Apply Expression

lsError = ldsExpression.Modify(lsExpression)

IF len(lsError) = 0 THEN ldsExpression.InsertRow(0)

//get the result

lsResult = ldsExpression.GetItemString(1,"condition_expression")

ELSE

lsResult = lsError

END IF

// Destroy instance of ldsExpression

DESTROY(ldsExpression)

RETURN lsResult