Concatenating two Strings with an ExpressionField
Here is my code:
Me.WFMGridGroupingControl.TableDescriptor.ExpressionFieldEvaluator.
AddFunction("getVendor", New Syncfusion.Grouping.ExpressionFieldEvaluator.LibraryFunction(AddressOf ComputeCustomAdd))
Dim newExpr As Syncfusion.Grouping.ExpressionFieldDescriptor = New Syncfusion.Grouping.ExpressionFieldDescriptor()
newExpr.Expression = "getVendor('[Todoby],[Generator]')"
newExpr.Name = "VendorEXPR"
newExpr.ResultType = "System.String, mscorlib"
Me.Tab_WFM_PROCESSGridGroupingControl.TableDescriptor.ExpressionFields.Add(newExpr)
Public Function ComputeCustomAdd(arguments As String) As String
Return ("arguments are: " & arguments)
End Function
The result that is displayed in the grid is: "arguments are: bj1,d1". The values in the columns Todoby and Generator are displayed correctly in the grid.
Can you help me with this problem?
Hi Gregor,
Thank you for your interest in Syncfusion products.
If you want to define the custom expression field descriptor for expression column, you need to define the string concatenation in ComputeFunc method. Please make use of below code and attached sample,
Dim evaluator As ExpressionFieldEvaluator = Me.gridGroupingControl1.TableDescriptor.ExpressionFieldEvaluator
evaluator.AddFunction("CONCATENATE", New Syncfusion.Grouping.ExpressionFieldEvaluator.LibraryFunction(ComputeFunc))
Dim f2 As ExpressionFieldDescriptor = New ExpressionFieldDescriptor("Result2", "CONCATENATE([Val1],[Val2])")
gridGroupingControl1.Engine.TableDescriptor.ExpressionFields.Add(f2)
Public Function ComputeFunc(ByVal s As String) As String
Dim comma As Char = Convert.ToChar(Me.gridGroupingControl1.Culture.TextInfo.ListSeparator)
Dim ss() As String = s.Split(comma)
Dim str1 As String = ss(0)
Dim str2 As String = ss(1)
Return (str1 + str2)
End Function
Please let me know if you have any concerns.
Regards,
Neelakandan
Attachment: Expression_Column_Customization_VB_f95e0345.zip
thank you for your answer. I am sorry to say, however, that you have not read my post nor my code exactly. If you had read it, you would have seen that I wrote the code exactly as described on the Syncfusion help pages.
The problem is that the parameter for the delegate function (ComputeFunc in your example) is not passed correctly. The error appears in your example too.
I have attached two screenshots for you to see the problem.
Can the reason for it be the Version of the Syncfusion controls? I use the version 11.1.0.21.
Regards,
Gregor.
Attachment: Screenshots_e8ef04f8.zip
Hi Gregor,
Regret for the inconvenience caused.
We analyzed your scenario at our end. We could not able to reproduce an issue in 11.1.0.21 version that you are mentioned in your last update. Please refer the below code and customize your expression function as per below code and also please refer the below attached sample video,
Dim evaluator As ExpressionFieldEvaluator = Me.gridGroupingControl1.TableDescriptor.ExpressionFieldEvaluator
evaluator.AddFunction("CONCATENATE", New Syncfusion.Grouping.ExpressionFieldEvaluator.LibraryFunction(AddressOf ComputeFunc))
Dim newExpr As New ExpressionFieldDescriptor("Result2", "CONCATENATE([Val1],[Val2])")
gridGroupingControl1.Engine.TableDescriptor.ExpressionFields.Add(newExpr)
Please refer the below UG link:
http://help.syncfusion.com/ug/windows%20forms/default.htm#!Documents/howtoaddcustomcalcul.htm
Please let me know if you have any concerns.
Regards,
Neelakandan
Attachment: Sample_and_Video_33b478fa.zip
those were the two most useless answers I have ever read.
Is there anyone out there who is willing to read my posts, understand them and help me with my problem?
Gregor.
Hello,
those were the two most useless answers I have ever read.
Is there anyone out there who is willing to read my posts, understand them and help me with my problem?
Gregor.
Hi Gregor,
We deeply regret for the inconvenience caused,
We have analyzed the reported issue in our end, GGC returns “Invalid Expression” error while you have used the custom function name as “GETVENDOR”. Because some issues are occurring in our source while parse the formula text. So please use any suitable name for your methods. Here we have modified the name as “CONC” please refer the below code.
evaluator.AddFunction("CONC", New Syncfusion.Grouping.ExpressionFieldEvaluator.LibraryFunction(AddressOf ComputeCustomAdd))
Dim f2 As New ExpressionFieldDescriptor("Result2", "CONC([Val1],[Val2])")
So please refer the attached sample and image also this will resolve the reported issue in your end and it returns the proper solution as you expected in ypur end. Fix for this issue will be included in our main volume release 2014 Vol 4. If you need fix as earlier that volume release please create incident using your Direct trac account, we will provide fix as earlier.

Regards,
Vinish Kumar,
Attachment: Expression_Column_Customization_VB_cb10a58.zip
- 6 Replies
- 3 Participants
-
GR Gregor
- Oct 29, 2014 05:24 AM UTC
- Nov 3, 2014 05:49 AM UTC