October 25, 2013 at 8:53 am
Hi,
i'm usting Dataflow task where i used OLEDB source to select data from the sql server the query looks like this
SELECT DISTINCT
wwo.Id AS WorkOrderId
,wwo.Code AS WorkOrderCode
,wwo.Id AS WOId
,(SELECT CAST(SUM(TotalInSiteCurrency) AS float) FROM dbo.wrkTaskSpares AS wts INNER JOIN
dbo.finCostElements AS fce ON wts.CostElementId =fce.Id
WHERE wt.Id = wts.ParentId AND fce.Id = 1047) as 'EstCost'
FROM wrkWorkorders AS wwo
INNER JOIN dbo.wrkTasks AS wt ON wwo.Id = wt.ParentId
WHERE wwo.WorkOrderStatusId = 1024
ORDER BY wwo.Code
the datatype for colunm EstCost is double-precision float [DT_R8]
I then connected my datasource to recordset destination and selected my variable User::rsRecordSet of type object i created and in the input columns i selected my 3 columns: WorkOrderCode,WorkOrderId and EstCost as readonly
i then created ForEach Loop container and selected "ForEach From Variable Enumerator" option. I created a variable of System.Object(User::rsRecordSet) and selected the "User::rsRecordSet" for Variable dropdown in Enumertaor configuration. i also created variable:
WorOrderCode - string
WorkOrderId - int32
EstCost - Double
and i mapped these variables in the foreach loop container.
if i test my package i'm getting the error Error: ForEach Variable Mapping number 3 to variable "User::EstCost" cannot be applied.
please help
thanks
October 27, 2013 at 3:11 pm
To assign the results of a query to an object variable, use an ExecuteSQL task, not a dataflow. Examples abound, here's one I found.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply