We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by @dodyg in #760 (comment)
Why does in this workflow "CurrentValue" variable is missing from IfTrue
IfTrue
public class Loop : IWorkflow { public void Build(IWorkflowBuilder builder) => builder .ForEach(x => new int[] { 10, 20, 30, 40 }, x => { x.IfTrue(condition: (ActivityExecutionContext m) => { var has = m.HasVariable("CurrentValue"); Console.WriteLine("Has variable " + has); var value = m.GetVariable<int>("CurrentValue"); Console.WriteLine("Debug Value " + value); return value == 40; }, whenTrue: (y) => { y.WriteLine("The last value"); }); }); }
but if I implement a custom activity, the variable are accessible
using Elsa; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Elsa.Builders; using Elsa.Services; using Elsa.ActivityResults; using Elsa.Services.Models; using System; using Elsa.Activities.ControlFlow; using Elsa.Activities.Console; using Elsa.Activities.Primitives; using var host = new HostBuilder() .ConfigureServices(services => { services.AddElsa(elsa => { elsa .AddConsoleActivities() .AddQuartzTemporalActivities() .AddWorkflow<Loop>() .AddActivity<Print>(); }); }) .UseConsoleLifetime() .Build(); await host.Services.GetService<IBuildsAndStartsWorkflow>().BuildAndStartWorkflowAsync<Loop>(); await host.WaitForShutdownAsync(); public class Loop : IWorkflow { public void Build(IWorkflowBuilder builder) => builder .ForEach(x => new int[] { 10, 20, 30, 40 }, x => { x.Then<Print>(); }); } public class Print : Activity { protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) { try { var index = context.GetVariable("CurrentIndex"); var value = context.GetVariable("CurrentValue"); System.Console.WriteLine($"Index {index} values {value} type {value.GetType()}"); return Done("No"); } catch(Exception ex) { return Fault(ex.Message); } } }
The text was updated successfully, but these errors were encountered:
e427a27
sfmskywalker
No branches or pull requests
Originally posted by @dodyg in #760 (comment)
Why does in this workflow "CurrentValue" variable is missing from
IfTrue
but if I implement a custom activity, the variable are accessible
The text was updated successfully, but these errors were encountered: