Filtering a list created from a UD Table

I have created a list for Manufacturing Areas(UD02) in our sites that is called up on Jobs, all worked fine when we only had 1 site on Kinetic but now i am adding another site i need to be able to filter the list depending on which site is raising the job.
the UD Table has Plant (UD02.ShortChar01) in it and that field is used as the Plant that the Manufacturing Area is used (Plant field there matches the plant field in Site Maintenance).

Anyone got any ideas?

I’m not sure WHERE or when you’re trying to do this. If this is an app, or dashboard, and the user is in the target site when filtering this list, you could filter it based on Constant.CurrentPlant.

Hi David, i want to do it in Job Entry when we create the job




Well, as soon as you create a new job, the JobHead dataview should be populated. So, you could add a Filter of: ShortChar01 = '?{JobHead.Plant}'

I never know where to put the filter, trial and error.

You can try:
Filter (filter is supposed to be applied when the rest call occurs)
Row Filter (filter is applies AFTER the rest call occurs)

Have tried that in all the places where a filter can go and it either does not filter anything or i get a correlation ID error and the Event is this

Ice.Common.SqlSecurityException: Possible SQL injection: 'Unexpected keyword'.
   at Ice.Data.SafeSql.SafeSqlHelper.ExecuteReader(SqlCommand sqlCommand) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.System\Data\SafeSql\SafeSqlHelper.cs:line 48
   at Ice.TablesetBound`3.<>c__DisplayClass26_0.<InnerGetRows>b__0() in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 263
   at Ice.Services.Trace.TablesetProfilingCollector.DoStoredProcedureTrace[TResult](String storedProcedureName, Func`1 action) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 164
   at Ice.TablesetBound`3.InnerGetRows(IceDataContext dataContext, Int32 pageSize, Int32 absolutePage, Boolean& morePages, TFullTableset tableset, IEnumerable`1 whereClauses) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 183
   at Ice.Services.BO.UD02Svc.GetRows(String whereClauseUD02, String whereClauseUD02Attch, Int32 pageSize, Int32 absolutePage, Boolean& morePages) in C:\_releases\ICE\ICE5.1.100.0\Source\Server\Services\BO\UD02\UD02.Designer.cs:line 643
   at Ice.Services.BO.UD02SvcFacade.GetRows(String whereClauseUD02, String whereClauseUD02Attch, Int32 pageSize, Int32 absolutePage, Boolean& morePages) in C:\_releases\ICE\ICE5.1.100.0\Source\Server\Services\BO\UD02\UD02SvcFacade.cs:line 337
   at InvokeStub_UD02SvcFacade.GetRows(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallInvoker(Type svcType, MethodInfo mi, Object[] inputs, Boolean isRoot, IceDataContext dataContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 401
   at Ice.Hosting.RestApi.OperationInvokeHelper.MakeServiceCall(IceDataContext dataContext, Type svcType, MethodInfo mi, Object[] parameters) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 350
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallCustomMethod(String serviceName, MethodInfo mi, Object[] paramList) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 305
   at Epicor.RESTApi.DataSources.CustomMethodCaller.CallMethodWithDynamicData(String serviceId, String methodName, IInputParamResolver inputResolver, Action`1 headersPublisher, Action`1 verifyMethod) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.RESTApi.Common\DataSources\Main\CustomMethodCaller.cs:line 60
   at Ice.Hosting.AspNetCore.Controllers.ServiceMethodCallController.InvokeGetMethod() in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Controllers\ServiceMethodCallController.cs:line 89
   at lambda_method13004(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Ice.Hosting.AspNetCore.Middleware.DynamicAssemblyPartMiddleware.Invoke(HttpContext context, CurrentCallInformationService currentCallInformation, ControllerLoader controllerLoader) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\DynamicAssemblyPartMiddleware.cs:line 32
   at Ice.Hosting.AspNetCore.Middleware.IPEnforcerMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\IPEnforcerMiddleware.cs:line 48
   at Ice.Hosting.AspNetCore.ETags.ETagMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\ETags\ETagMiddleware.cs:line 89
   at Ice.Hosting.AspNetCore.ETags.ETagMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\ETags\ETagMiddleware.cs:line 107
   at Ice.Hosting.AspNetCore.Middleware.DecompressRequestMiddleware.Invoke(HttpContext context) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\DecompressRequestMiddleware.cs:line 41
   at Ice.Hosting.AspNetCore.Middleware.AuthenticationMiddleware.InvokeAsync(HttpContext httpContext, CurrentCallInformationService callInformation) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\AuthenticationMiddleware.cs:line 76
   at Ice.Hosting.AspNetCore.Middleware.CallHeaderMiddleware.InvokeAsync(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\CallHeaderMiddleware.cs:line 51
   at Ice.Hosting.AspNetCore.Middleware.OperationDisposerMiddleware.InvokeAsync(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\OperationDisposerMiddleware.cs:line 23
   at Ice.Hosting.AspNetCore.Middleware.ApiKeyEnforcerMiddleware.Invoke(HttpContext context) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\ApiKeyEnforcerMiddleware.cs:line 77
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
CorrelationId: 379457e8-bd6b-42d7-8996-a267499ed11e

This is odd, i have got other filters to work previously but this just has other ideas. I can get it to filter using a boolean that is out of the box, anything else …
david walliams GIF

What is your combobox bound to? Is it JobHead.something?

Yeah - JobHead.MfgArea_c

I got it to work… using Ice.BO.UD02Svc, GetRows.

My UD02 table is used for something completely different, so you’ll have to forgive my example is not even close to what you’re doing… but…

In Filters, I’m defining what my filters ARE… you can call these whatever you want.

For example, you might be able to set up a filter of ShortChar01='?{MyFilter}'

In Filter Param, I’m telling it what column to look at (IN MY Combobox’s bound dataview) to find the value.

(You can ignore the Key2 filters… I was just testing a secondary filter based on a static value… and that worked as well)

So, in my example, my combobox was bound to TransView.MyCombo

I’m telling it to filter my UD02 Key1 based on a filter I call ?{PartNum}.

In Filter Params I’m saying “PartNum” should equal ?[PartNum] value… and it looks at TransView.PartNum for this value.

These “Filters” get added to your whereClauseUD02 (which you can see in debugger > Network > Payload on the GetRows):

So… for your use case… I would try:

Filter: ShortChar01='?{Plant}'
(and again, I think you can call that anything.. but your Filter Param will need to match whatever you choose to use)

Filter Param: Plant = ?[Plant]
(and since your combo is bound to JobHead, it should look at JobHead.Plant for the value).

NOTE: Filter uses curly brackets… Filter Param uses Square Brackets.

Give that a try and see what happens.

1 Like

Should i be filling anything else in on the Re-Usable Combo?


I am still getting the same error

Ice.Common.SqlSecurityException: Possible SQL injection: 'Unexpected keyword'.
   at Ice.Data.SafeSql.SafeSqlHelper.ExecuteReader(SqlCommand sqlCommand) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.System\Data\SafeSql\SafeSqlHelper.cs:line 48
   at Ice.TablesetBound`3.<>c__DisplayClass26_0.<InnerGetRows>b__0() in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 263
   at Ice.Services.Trace.TablesetProfilingCollector.DoStoredProcedureTrace[TResult](String storedProcedureName, Func`1 action) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 164
   at Ice.TablesetBound`3.InnerGetRows(IceDataContext dataContext, Int32 pageSize, Int32 absolutePage, Boolean& morePages, TFullTableset tableset, IEnumerable`1 whereClauses) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 183
   at Ice.Services.BO.UD02Svc.GetRows(String whereClauseUD02, String whereClauseUD02Attch, Int32 pageSize, Int32 absolutePage, Boolean& morePages) in C:\_releases\ICE\ICE5.1.100.0\Source\Server\Services\BO\UD02\UD02.Designer.cs:line 643
   at Ice.Services.BO.UD02SvcFacade.GetRows(String whereClauseUD02, String whereClauseUD02Attch, Int32 pageSize, Int32 absolutePage, Boolean& morePages) in C:\_releases\ICE\ICE5.1.100.0\Source\Server\Services\BO\UD02\UD02SvcFacade.cs:line 337
   at InvokeStub_UD02SvcFacade.GetRows(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallInvoker(Type svcType, MethodInfo mi, Object[] inputs, Boolean isRoot, IceDataContext dataContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 401
   at Ice.Hosting.RestApi.OperationInvokeHelper.MakeServiceCall(IceDataContext dataContext, Type svcType, MethodInfo mi, Object[] parameters) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 350
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallCustomMethod(String serviceName, MethodInfo mi, Object[] paramList) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.Ice\Hosting\RestApi\OperationInvokeHelper.cs:line 305
   at Epicor.RESTApi.DataSources.CustomMethodCaller.CallMethodWithDynamicData(String serviceId, String methodName, IInputParamResolver inputResolver, Action`1 headersPublisher, Action`1 verifyMethod) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Framework\Epicor.RESTApi.Common\DataSources\Main\CustomMethodCaller.cs:line 60
   at Ice.Hosting.AspNetCore.Controllers.ServiceMethodCallController.InvokeGetMethod() in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Controllers\ServiceMethodCallController.cs:line 89
   at lambda_method5803(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Ice.Hosting.AspNetCore.Middleware.DynamicAssemblyPartMiddleware.Invoke(HttpContext context, CurrentCallInformationService currentCallInformation, ControllerLoader controllerLoader) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\DynamicAssemblyPartMiddleware.cs:line 32
   at Ice.Hosting.AspNetCore.Middleware.IPEnforcerMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\IPEnforcerMiddleware.cs:line 48
   at Ice.Hosting.AspNetCore.ETags.ETagMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\ETags\ETagMiddleware.cs:line 89
   at Ice.Hosting.AspNetCore.ETags.ETagMiddleware.Invoke(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\ETags\ETagMiddleware.cs:line 107
   at Ice.Hosting.AspNetCore.Middleware.DecompressRequestMiddleware.Invoke(HttpContext context) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\DecompressRequestMiddleware.cs:line 41
   at Ice.Hosting.AspNetCore.Middleware.AuthenticationMiddleware.InvokeAsync(HttpContext httpContext, CurrentCallInformationService callInformation) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\AuthenticationMiddleware.cs:line 76
   at Ice.Hosting.AspNetCore.Middleware.CallHeaderMiddleware.InvokeAsync(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\CallHeaderMiddleware.cs:line 51
   at Ice.Hosting.AspNetCore.Middleware.OperationDisposerMiddleware.InvokeAsync(HttpContext httpContext) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\OperationDisposerMiddleware.cs:line 23
   at Ice.Hosting.AspNetCore.Middleware.ApiKeyEnforcerMiddleware.Invoke(HttpContext context) in C:\_releases\ICE\ICE5.1.100.6\Source\Server\Hosting\AspNetCore\Ice.Hosting.AspNetCore\Middleware\ApiKeyEnforcerMiddleware.cs:line 77
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
CorrelationId: 07e83085-c2fd-4040-83c7-4a903113af84

Take your Table Name out, see if that’s causing the issue.

Here are my settings:

No change

1 Like

For some reason it is not filtering at all, i changed the setup so that it was using Key1 as the Plant in my UD02 table and then changed the filters in the combo box on Job to replicate what you have done and it lists all the areas in UD02 not a filtered list :thinking:

So i can filter the list with a fixed filter such as Key1='mfgsys' but it isnt filtering based on anything else.

Yeah, I was able to filter using a fixed/static value without any issue. But I had to use the Filters & Filter Params in order to use a value based on a dataview.column.

Have you tried doing a reset? I wonder if App Studio if holding on to some setting in the background which you’ve changed. Save, exit app studio… come back in, check your settings to see if they’re what they should be.

I’m sorry I don’t have a better solution.

~*~

Alternative Route:

Since this approach isn’t working, you may try using a dataview to populate the combobox. You would need to create a UD02 dataview. If you use the wizard, it will create the Get event for you. You can set the BO to Ice.BO.UD02Svc and Method to GetRows.

In the event it creates you’ll have to set the Method Parameters:

Toggle through each parameter… whereClauseUD02 and whereClauseUD02Attch will be the same.

Page Size and Absolute Page can just use a value of 0 (but you have to put something in there).

Then set the trigger to whatever makes sense. After form_onload… or somewhere early so you know the dataview gets populated.

Then your combobox settings would just be (3) settings. The name of the dataview you created for UD02, and then the text and value fields under advanced:


I just tested the above and it worked for me.

1 Like

Thanks for your perseverance with this David, not sure why the first method didnt work but the second seems to be working. I will do some more testing first but at first try it looks good :+1:



2 Likes

More than 1 way to skin the cat, I guess. not sure why the first approach worked for me but not for you. Perhaps a version issue?? Who knows. But glad you got something moving forward!!

Cheers!