Skip to main content

I am trying to use my workflow to calculate an expected delivery date from a sharepoint 2010 list column, however when I use the add days function in K2 Studio, I get an "input string not in a correct format error"

 

The list contains a radio button column that has different shipping options. I then use a calculated column to draw up a number of days added to the list item submission date (an expected delivery date) which is based upon the shipping choice selection. The formula in the column works correctly and is set to output a "number" in Sharepoint.

 

The problem arises when I attempt to use the Add Days function in K2 Studio. For reference, here is what works and has not worked:

 

AddDays(RequestDate,ToInteger(TotalDaysAdded)) - throws the input string not in a correct format error in K2 Workspace.

AddDays(RequestDate, 14) - works correctly and displays a correct date.

AddDays(RequestDate, TotalDaysAdded) - does not allow the wizard to continue because it expects an integer argument.

 

RequestDate is a list column that is set to Date and Time in Sharepoint.

 

At this point, I'm not sure why exactly the ToInteger function is not correctly converting the TotalDaysAdded field to an integer. Is there something wrong with my logic here that I'm overlooking? Perhaps a different conversion or a different Sharepoint column value type?

 

 

 

Hi csunder

 

I am assuming you have created a SmartObject for your SharePoint list? Can you confirm a) what data type the TotalDaysAdded property is set to in the SmartObject and b) how you are getting the TotalDaysAdded value in your workflow (are you passing it in as a data field, getting it from a smartobject method?)

 

It may be that either the value you are returning is not in a format that can be converted to an int, or that it is empty.


Andrew,

 

I do have a smartobject forthe list/workflow. However, I have no defined data fields in the context browser (Process / Activity Data -> Data Fields portion) and have been attempting to simply drag the list column name from the Process /Activity Data -> XML section of the context browser menu. Perhaps this is what I'm doing wrong here. I am mostly self-taught with K2 and this is my first major project.

 

Using the SmartObject Tester Tool, the data type reported in the TotalDaysAdded list column is float, which I believe is typical behavior for the Sharepoint "number" setting.

 

Thanks for the reply and let me know if there's any other info I can provide.


I would create a reference to the SharePoint list item in the Workflow. I assume you have the Id of the list item available - create a reference to the List item read method (GetListItem ?) and then use this to get your value for the add days function.


I just wanted to post back with the resolution I found for this. There was an underlying problem with my workflow that was causing the issues with the Add Days function. Once it was corrected, the conversion formulas operated correctly again and resolved the issue. However, it might be of note to mention that originally, I was using a calculated column which presented an issue during conversion. Sharepoint returned values from the calculated column in a format like "float;#2" or something similar which didn't seem to resolve when trying to send it as an argument to the ToInteger function inside K2. I worked around that issue by changing my column to a number (not calculated) and doing calculation in code rather than in Sharepoint.


Reply