0

I would like to ask you for your help with the definition of the method parameter.

I have this method definition:

[Method("Date from DataField")]
public DateTime DateTimeFromDataField([Parameter(DataSourceName = DataSourceHolders.InputTemplatesDataTreeSource, ValueInputType = ValueInputType.All)] string nodeKey) 
{
         /* some return code */ 
}

My problem is that I have the parameter with the datasource type string. This parameter is ignored. I found this part of your documentation:

DataSourceName Type : System.String Used only in rule action or in-rule method parameters that represent System.Int parameters of qualified .NET methods, and is ignored for parameters of other types. Gets or sets the unique name of the Dynamic Menu Data Source declared by the SourceAttribute on the source object. If set, the rule author can only select the value from the menu of items supplied by the data source method.

I would like to ask you whether there is other solution how to pass string value as datasource parameter ?

Martin Majoroš
  • 409
  • 1
  • 6
  • 17

1 Answers1

0

Code Effects rule editor doesn't support string IDs in menu data sources. You can always add auto-incrementing column to your table and use it instead of the string ID. That's the most common way to replace strings with integers.

Alex
  • 566
  • 1
  • 6
  • 14
  • I very much appreciate your prompt response. Not everybody has the data presentend in tables. There are also other data structures. ;-) I have a tree structure that can be dynamically edited. And the string key is unique path to node - and this key is independ of the order which can be changed by user. Possibility to pass string value would be the esiest way for me. Now I have to manage number indexes and for me it is unnecessary code. I think that string value limitation is infelicitous. I have to implement a workaround. – Martin Majoroš Feb 23 '17 at 07:05