www.skelta.com
Home      Members   Calendar   Who's On

Welcome Guest ( Login | Register )
      

Home » BPM.NET 2007/Sharepoint Accelerator 2007 » BPM.NET 2007/Sharepoint Accelerator 2007 » Workflow Execution » How to assign an activity to an array of...

14 posts, Page 2 of 2. ««12

How to assign an activity to an array of...Expand / Collapse
Author
Message
Posted Wednesday, February 13, 2008
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Wednesday, March 05, 2008
Posts: 80, Visits: 277
Hello once again.

Using the code you gave and changing only the var name to guidTeste:
//Sample CSharp code
using System;
using Workflow.NET;
using Workflow.NET.Engine;
using System.Collections;
public class Script2
{
public string Run(int ExecutionId, int ExecutionDetailsId, Workflow.NET.Engine.Context ctx, Action action, string inlink)
{
ArrayList resvariable = (ArrayList)ctx.Variables["guidTeste"].Value;
ArrayList listGuids = new ArrayList();
foreach (Resource resource in resvariable)
{ listGuids.Add(resource.Properties.Identifier.Value);
}
ctx.log.LogInformation("@@@@:" + listGuids.Count);
ctx.Variables["guidTeste"].Value = listGuids;
ctx.SaveVariables();
return "ok";
}
}


I get the following error:
i - @#@Date - 18:12:36.643@#@ApplicationName - SNITURHFormsRepository@#@WorkflowName - UC1.3_-_Pedido_de_Informacao_Previa@#@ExecutionId - 1645@#@Module - C:\WINDOWS\assembly\GAC_MSIL\Workflow.NET.NET2\3.5.0.0__c932f724c984e915\Workflow.NET.NET2.dll@#@FileName - RunTime.cs@#@_MachineName - SNITURHDEV2RC, Process - WFEngine.NET2@#@Message - Starting Workflow (UC1.3_-_Pedido_de_Informacao_Previa) with executionid - 1645 for application (SNITURHFormsRepository), in AppDomain (appCaheSNITURHFormsRepository)@#@
i - @#@Date - 18:12:36.853@#@Module - C:\WINDOWS\assembly\GAC_MSIL\Workflow.NET.NET2\3.5.0.0__c932f724c984e915\Workflow.NET.NET2.dll@#@FileName - Context.cs@#@_MachineName - SNITURHDEV2RC, Process - WFEngine.NET2@#@Message - Completed - Action Start for ExecutionID=1645 ExecutionDetailsID=22336 Exiting with Output=@#@
i - @#@Date - 18:12:40.438@#@Module - C:\WINDOWS\assembly\GAC_MSIL\Workflow.NET.ActionHandler.NET2\3.5.0.0__d6d141d290294c87\Workflow.NET.ActionHandler.NET2.dll@#@FileName - Context.cs@#@_MachineName - SNITURHDEV2RC, Process - WFEngine.NET2@#@Message - Resource array assigned to variable - guidTeste (type - array), ArrayCount - 1, Real-ResourceIdentifiers - sqlprovider::1388943c-d70b-4494-b702-fd260b421f38.@#@
i - @#@Date - 18:12:42.201@#@Module - C:\WINDOWS\assembly\GAC_MSIL\Workflow.NET.NET2\3.5.0.0__c932f724c984e915\Workflow.NET.NET2.dll@#@_MachineName - SNITURHDEV2RC, Process - WFEngine.NET2@#@Message - **** Error while executing GetProcessedValue : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. - System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Workflow.NET.Resource'.
at Script2.Run(Int32 ExecutionId, Int32 ExecutionDetailsId, Context ctx, Action action, String inlink)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Workflow.NET.PropertyTypes.PropertyMemo.x48be1481a42c19e3(Int32 x99bbe3a0831cff64, Int32 x8e463abe161afc8c, Context _x0f7b23d1c393aed9, Action xab8fe3cd8c5556fb, String x04c44b8a1c5eaf5e)@#@
! - @#@Source - at Workflow.NET.PropertyTypes.PropertyMemo.x48be1481a42c19e3(Int32 x99bbe3a0831cff64, Int32 x8e463abe161afc8c, Context _x0f7b23d1c393aed9, Action xab8fe3cd8c5556fb, String x04c44b8a1c5eaf5e)
at Workflow.NET.ActionHandler.ScriptHandler.Run(Int32 ExecutionID, Int32 ExecutionDetailsId, Context CurrentContext, Action CurrentAction, String InlinkOutput, Boolean Retry, String& Output)
at Workflow.NET.Engine.RunTime.PerformActionThread(Object Params)@#@Date - 18:12:42.211@#@ApplicationName - SNITURHFormsRepository@#@WorkflowName - UC1.3_-_Pedido_de_Informacao_Previa@#@ExecutionId - 1645@#@ExecutionDetailsId - 22342@#@Module - C:\WINDOWS\assembly\GAC_MSIL\Workflow.NET.NET2\3.5.0.0__c932f724c984e915\Workflow.NET.NET2.dll@#@FileName - RunTime.cs@#@_MachineName - SNITURHDEV2RC, Process - WFEngine.NET2@#@Message - Error while running the Action or Handling the event- Script2 for ExecutionDetailsID=22342, - Exception has been thrown by the target of an invocation., Inner Exception :Unable to cast object of type 'System.String' to type 'Workflow.NET.Resource'.@#@


Please advise.

Best regards,

Rui Costa

Post #545
Posted Wednesday, February 13, 2008
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 4:03 PM
Posts: 132, Visits: 425
Hi,
The sample will work if the array value is of type resource. Based on the log the value is of type string.I have made a small modification to the sample code.
foreach (string resource in resvariable)
{
listGuids.Add(new Guid(resource.Split(new string[] { "::" }, StringSplitOptions.None)[1]));
}

regards, 

Moderator
Post #549
Posted Thursday, February 14, 2008
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Wednesday, March 05, 2008
Posts: 80, Visits: 277
Hello once again.

The solution provided worked perfectly, thank you very much.

How does one create in design time an array of type resource so that the previous post would work?

Thanks once again for your help.

Best regards,

Rui Costa

Post #550
Posted Thursday, February 14, 2008
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 4:03 PM
Posts: 132, Visits: 425
Hi,
There are no built in activties which will create resource array. This can be achieved through script activity. Please also note that the current beaviour of resource variable will change in next release. You'll be able to directly use the Array as you had used initially with out script activity in between.

regards,

Moderator
Post #551
« Prev Topic | Next Topic »

14 posts, Page 2 of 2. ««12

Reading This TopicExpand / Collapse
-
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.

All times are GMT -5:00, Time now is 3:28pm

 
Execution: 0.125.9 queries.Compression Enabled.

Copyright © 2002 - 2007 Skelta Software. All rights reserved. Tel: 1 (703) 229-6732 | Email:sales@skelta.com
Skelta - A BPM Workflow Software Company