Coersion Failure Revisited - Unable to transform the input lookup data into the requested type

  • 28 April 2016
  • 2 replies
  • 4 views

Badge +1

The previous question on this was assumed answered, but it actually wasn't answered.  I'm going to re-open the discussion.  Here is an overview of the issue as it exists in my context.

Setting: 2 lists. List A has a lookup column that references List B (Menu Item) and pulls in an additional field (Cost).  The List A shows it as Menu Item:Cost.  In both lists, the value is a number.

Workflow (list A - a meal scheduling list): Take the lookup in List B:Cost (which is a number that is the cost of a menu item - list B is just a plain menu, unit cost, vendor list), and convert it into a variable, which is also a number. Call it "Cost" (this is where the error occurs - tried to directly use the number, tried to create a variable, tried to use it as currency, tried to use it as a single line of text...same result: coersion failed). Multiply "Cost" by number of people in the meeting, store that value in variable "subtotal", update subtotal field with variable, etc, etc, with tax and total cost.

The problem is that the lookup (which has successfully worked for me in the past) cannot seem to take the additional field data (which is a number in this case) and make any sense of it in the destination list.  Seems so simple, but 28 errors later, I'm scratching my head - corrupted list?


2 replies

Badge +11

Hi Chris,

not sure if i understand your issue but if you want to fill in a lookup field via workflow, you only have to update your list a item with the ID of the list b item you want to lookup. All additional information about that list b item which is displayed in your list a should be fetched automatically by sharepoint.

Regards

Philipp

Badge +1

Not exactly, Philipp, but thanks for the reply.  What I found yesterday was the when I pull over a field that is a number from one list to another via a lookup, to be able to do anything with it, I need to have a workflow convert that number into a single line of text and store it in a variable.  For whatever reason, it seems to hit that coersion error until it is converted to text rather than a number (which is counter-intuitive, to say the least).  This did fix it and I validated it in multiple contexts.

To summarize: lookup field in list A grabs item in list B. I also have it grab one additional column that is a number (meal, and meal:price).  To get it to do the math for subtotal, tax, and total cost in list A, I need to store the value for meal:price as a single line of text variable in my workflow (as opposed to trying to leave it as a number).  If I don't, the coersion failure happens.  If I do, the SLT behaves just fine masquerading as a number.    

Reply