Solved

How to set columns to null via SMO update?

  • 27 April 2020
  • 7 replies
  • 41 views

I have a SMO backed by a DB Table, and I'm trying to set the value of one of the columns to null using Update method but it's not working. I'm doing this from within Workflow and setting the value to EmptyString function.

 

So what's the workaround?

icon

Best answer by Praveen123 28 April 2020, 04:02

View original

7 replies

Hi Praveen123,


 


May I please know on what do you mean by not working ? Is there any error shown ?


 


Cheers,


Kate

It's not updating to null or not clearing the value in DB. I'm also setting another field with different value in same update call and that is getting updated correctly. The column under question is FileContent type in SMO if that helps.
Userlevel 4
Badge +13

Hi  @Praveen123 ,


 


If the file attachment is saved as scnull, it will be stored in the database as the following:  


<file><name>scnull</name><content>scnull</content></file>


 


That means you will not be able to retrieve the file attachment to be displayed on your Form. Please take note of the impact of doing so. 


 


Cheers,


Kimberly 


 


K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.

Thanks Kimberly. That's what I noticed when I used GetFileFromContent function and passed empty text in content. Looks like we will have to use stored proc or trigger in DB to nullify the column value.

 

Thank you both - Kate and Kimberly - for responding to my query.

 

Hi,
 
In your workflow you can call your SMO to update your database to set your column to null like this :
 
I tried and it worked for me.
 
Note: I'm working on K2 5.1. What's your version ?
 
Michel From Flow Factory

Thanks for replying. Unfortunately, in my case it's not a Memo type but a File Content type. 

How to find table name through SMO?

Reply