Passing SCNULL, NULL, EmptyString, etc into a Reference to a SmartObject in K2Studio

  • 1 March 2017
  • 0 replies
  • 126 views

Hello,

 

I am working in K2 Studio.  I have a SmartObject created from a C# webservice function. We'll call the SmartObject "SO_GetList".   I'm simplifying things a bit here, but the webservice function goes something like this:

 public List<MyListObject> GetList(string code, string description){...do some work here and return a list of MyListObject...}

There are two parameters, "code" and "description".  Either one can be an empty string and the function will still work.  Each one just provides some filtering if needed.

 

In the SmartObject Tester, I'm able to execute the List method of this "SO_GetList" smartobject by either supplying a value for "code" and "description", or just supplying a value for "code" and entering "scnull" for "description.  It all works as expected.  I could even supply "scnull" for both "code" and "description" and it would still run.  Perfect.

 

However, in K2 Studio, this is not working at all.  Over on the left under Object Browser, I've created a Reference called "Ref_GetList" and assigned it to "SO_GetList.List".  For "code" I've assigned it to a value I'm getting from another object.  For "description" I do not have the ability to simply type "scnull" as the value.  It is forcing me to select either a function, smartobject, data field, etc. 

Question 1 - why can't I simply type a value here?

 

To try to get around not being able to type a value, I've tried the following functions/expressions and none of them work:

  • TRIM() – fails at runtime
  • TRIM(“scnull”) - fails at runtime
  • TRIM(scnull) – fails at runtime 
  • EXPRESSION (“scnull”) - fails at runtime
  • EXPRESSION (scnull) – K2 Studio will not allow this, needs quotations
  • IF(TRUE,scnull,scnull) - fails at runtime
  • EMPTYSTRING() – fails at runtime
  • Just leaving the parameter blank - K2 Studio will not allow this, needs value
  • I've even created a string Data Field = scnull - this also fails at runtime

 

Question 2 - since I can't type a value, is there another function/idea I've missed that may work?

 

As a last resort, I'll request that the webservice I'm using be updated to allow for a single character space " " to be entered as the "description" which will then be trimmed and turned into an empty string again.  I'd like to avoid this if possible.


0 replies

Be the first to reply!

Reply