Look at the Time

A big thing to watch out for when you’re building an application in K2 blackpearl with an RDBMS back end is an understanding of how to treat datetime values.

K2 uses the value scnull to indicate a NULL value. This becomes especially important in SmartObject calls down to, say, stored procedures in your database.

The problem is, you can’t pass a value of scnull into, say, a workflow datafield that’s expecting a datetime value. For that, you have to use an actual datetime value like 1/1/1900.

All of this manipulation can make things pretty hairy when you’re trying to feed a SmartObject and start a workflow at the same time. If your datetime value is on a SmartForm, and you anticipate having to deal with blank or NULL values, you might consider adding a hidden data label or two and expressions to go along with them. That way, you can convert the calendar control value into something useful for the database in one data label, and something useful for data fields in another.

Look at the Time

The Devil is in the Details

I was having trouble with a SmartForm view recently — I couldn’t figure out why execution of this SmartObject method was taking so long! I could execute the SmartObject from within the SmartObject Services Tester and it would complete in less than a half-second; I even went down further and ran the procedure directly from SQL Management Studio… everything at the data layer looked “clean and green.”

Continue reading “The Devil is in the Details”

The Devil is in the Details

Using a List Display Control Inside a SmartForm View

I was recently tasked with creating a series of editable SmartForm views based on some that already existed elsewhere in the application. One of the views was based on a SmartObject that contained a series of ID’s pointing to other database tables. The task was to have the list view list the text of the records the ID’s pointed to — not the actual ID’s. Makes sense – to display a value of “1” probably isn’t going to mean anything to the user, but a value of “ALL” will.

Doing this in the list view is the job of the List Display control. The List Display lets one configure the relationship between the SmartObject value and another value in a different SmartObject.

I had thought that my task should be relatively easy — save the original view as the view I was creating, change a little wiring, and I’d be good to go. Not so. For reasons I don’t understand, I simply could NOT make the the properties of my “new version” of the old list view resemble what I needed for the List Display to work.

In my case, it was just easier to start over.

And I found that starting over was exactly what I needed — everything fell in line effortlessly — so much so that I’m a little mad at myself for spending so much time yesterday on trying to make my former approach work.

All to your benefit — because I’m about to walk you through using a List Display object in an editable SmartForms View.

Continue reading “Using a List Display Control Inside a SmartForm View”

Using a List Display Control Inside a SmartForm View

Make the Database Return ALL of Your HTML — Using XSLT

In the second post of this series I showed how you could use XML functions to return your recordset from the database as HTML

row and cell elements (“Make the Database Return Your Recordset as an HTML Table — Using XML”, 8/6/2016). We did this by naming the XML elements after the appropriate HTML elements.

If we stopped at this point, we could create a SmartObject that returns our string of HTML

data to the caller. For example, we can already have the HTML for the rest of the report elsewhere, and this SmartObject simply “plugs in” the data to be displayed. This could be as easy as concatenating strings (say, an HTML report header, the HTML

output from the SmartObject, and an HTML report footer) in a Data Event.

We can go further. By using XSL Transform, we should be able to have the database return our entire HTML report — not just the table.

Continue reading “Make the Database Return ALL of Your HTML — Using XSLT”

Make the Database Return ALL of Your HTML — Using XSLT

Access Your Workflow, SmartObjects through Server Events

My new challenge: Reporting. Over a series of posts, I’ll take you through how such a report was originally being built, then I’ll walk you through my progress (so far) on a slight redesign that may improve performance.

Continue reading “Access Your Workflow, SmartObjects through Server Events”

Access Your Workflow, SmartObjects through Server Events

SmartObject Service Method Transactional Processing: What Not to Do

File under “I Learned This One the Hard Way”: When configuring the service method details during SmartObject creation, consider leaving the Transaction option set at “Continue,” and handling your transaction goop closer to source.

Continue reading “SmartObject Service Method Transactional Processing: What Not to Do”

SmartObject Service Method Transactional Processing: What Not to Do