DBTools Export / Config Task YAML do not contain all necessary mapping information for Automation Commands

If you do a DBTools Export or a Configuration Task selection that creates YAML for Automation Commands that have Multiple Mappings, those mappings are not included in the Export/YAML. So when trying to Import the affected export, or run the Config Task containing the affected YAML, they will fail with:

Sequence contains more than one matching element

For example, given this Automation Command with multiple Mappings, the Terminal, UserRole, Department, and Ticket Type are not included in the Export/YML:

This problem is clearly illustrated in a Config Task YAML export in the AutomationCommandMaps section at the bottom - this will cause an error when the Task is run:

AutomationCommands:
- Name: QMX Price Change
  ButtonHeader: New Price
  Color: '#FFF48481'
  FontSize: 26
  SortOrder: 720
  ClearSelection: true
  Category: QMX
  AutomationCommandMaps:
  - DisplayOnOrders: true
    EnabledStates: '*'
    VisibleStates: '*'
  - DisplayOnOrders: true
    EnabledStates: '*'
    VisibleStates: '*'
  - DisplayOnOrders: true
    EnabledStates: '*'
    VisibleStates: '*'

When attempting to run the Task (or import the DBTools Export), the following error appears:

image

In the Logfile, we see this:

-----------------------------
[General Info]

Application: SambaPOS
Version:     5.2.3
Region:      en
DB:          SQ
Machine:     QBOOK
User:        Quentin
Date:        2018-05-04
Time:        15:47

User Explanation:

Quentin said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.InvalidOperationException
Message:     Sequence contains more than one matching element
Source:      System.Core
Stack Trace: at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Samba.Infrastructure.Data.Injection.DtoCopyInjection.SetValue(ConventionInfo c)
   at Omu.ValueInjecter.ConventionInjection.Inject(Object source, Object target)
   at Omu.ValueInjecter.ValueInjection.Map(Object source, Object target)
   at Omu.ValueInjecter.StaticValueInjecter.InjectFrom[T](Object target, Object[] source)
   at Samba.Presentation.ClientLibrary.Modules.DatabaseModule.Tools.ExportTools.GenericImporter.Import[TClass,TDto](IList`1 dtos) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\DatabaseModule\Tools\ExportTools\ImportManager.cs:line 540
   at Samba.Presentation.ClientLibrary.Modules.DatabaseModule.Tools.ExportTools.ImportManager.Import(ExportDefinition exportDefinition) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\DatabaseModule\Tools\ExportTools\ImportManager.cs:line 51
   at Samba.Presentation.ClientLibrary.Modules.DatabaseModule.ExportHelper.ExecuteSingleTask(AutoConfigurationTaskItem taskItem, Dictionary`2 keys, Object dataObject) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\DatabaseModule\ExportHelper.cs:line 163
   at CallSite.Target(Closure , CallSite , ExportHelper , AutoConfigurationTaskItem , Dictionary`2 , Object )
   at Samba.Presentation.ClientLibrary.Modules.DatabaseModule.ExportHelper.ExecuteTask(AutoConfigurationTask task, Dictionary`2 keys) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\DatabaseModule\ExportHelper.cs:line 124

-----------------------------

[Assembly Info]

mscorlib, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
System, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
System.Configuration, Version=4.0.0.0
System.Xaml, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
Samba.Presentation.Common, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Core, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
DevExpress.Data.v16.2, Version=16.2.6.0
DevExpress.Xpf.Core.v16.2, Version=16.2.6.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
Samba.Localization, Version=1.0.0.0
Samba.Persistance, Version=1.0.0.0
FastButton, Version=1.0.0.0

-----------------------------

[System Info]

Operating System
-Microsoft Windows 10 Home
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = -360
--FreePhysicalMemory = 3563696
--OSArchitecture = 64-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 10.0.15063

Machine
-QBOOK
--Manufacturer = HP
--Model = HP Spectre x360 Convertible     
--TotalPhysicalMemory = 8496979968
--UserName = QBOOK\Quentin

-----------------------------

Are we able to import/export things with mappings as well? I am currently setting up print jobs for over 13 printers and a really tedious time daunting task when you have to list each station for each category since they want certain stations to print at certain printers for certain food.

Usually in most cases I believe so. Not remembering specifics, I think most things retain mappings but some don’t. You should try it and check.

2 Likes

I didn’t see mappings on anything I needed that’s why I asked. Like order tags don’t have mappings for example. It’s a bummer cause it would be really beneficial for us.

Yeah I have noticed before Order Tags don’t import mappings.

Possibly the reason for this is because you can’t import Products this way, and most things that retain mappings can also be imported.

I would imagine to be able to have mappings for Order Tags, additional checks would be needed to ensure the Products / Product Groups exist already. However having said that, I have seen mappings imported before that map to other things not on the target database (obviously you need to fix manually afterwards) so in that respect, same could be done for Order Tags.

1 Like