Anyone know if there is a method to invoke a DB Tools Import via Automation, or Config Task, or … ???
wish i asked this, would be a better solution to my last question!
A decent request if its not possible
Not that i have seen… and i have gone through each action almost extensively to see what parameters i could use in a rule… i think this could be a good feature request
You can use Config Tasks to import rules, actions, etc exactly like a DB Tool File would. You even select the rules etc the same way. This means you wouldnt need to create the DB Tools Task you can simply make a config task instead and use the YAML option.
The main difference is you can simply select them stock… just like DB Tool File or you can go step further and actually import them with custom parameters by putting [?param] inside the YAML that it creates and based on what you enter for the parameter it will fill it in.
PS Sorry if that was confusing I am not at a terminal to show you.
To sum it up Config tasks can be used for basic import or deletion of Rules/Actions/Commands etc
It can be used to execute SQL,
It can be used to Execute JSCRIPT,
It can be used for validation
You can use all of that at same time even in one task.
The coolest part of it is how you can insert and create your own parameters in it. For any part of it. If you want it to insert an action with a specific action constraint and the constraint requires inpurt from the user to set it up because each user is different… you can do that. You can create a prompt that asks for input… then it takes that input and inserts it in your config task wherever you want it meaning it can be inserted directly into SQL or JSCRIPT, or the YAML.
And finally config tasks can be automated with the Execute Configuration Task action. You can store them in your own online Repository and use that for your entire fleet of stores or venues. Meaning you create it once upload it to your repository simply point your SambaPOS to that repository and bam the config task is available.
I need to learn this too then lol
I was reading how kendash did that in his repository once he mentioned that in the reply to my question. hehe.
Yes it’s very powerful. Adding validations and parameters makes it mind boggling powerful. And it’s really easier than it seems to build them.
@Jesse, so say I create a Config Task and save it.
Where/how do I upload to a Repository URL ?
How is it that things like Advanced Split Payments (your Task I believe) is already automatically included?
In settings > localsettings then Online Services you can put links to your reposiitories. I use github gists myself.
My personal respository is located here:
You use a link to your config YAML take a look at my repository to see how to format the config.yaml
You can even define specific SambaPOS version requirements in case you build a config task that will only work with specific version forward preventing people with lower versions from trying to install the task.
THe original deal was Emre would look at forum contributions to tasks and add them to the official repository. But you can link in anyones repository.
Yes I saw that. But where is the Task (file?) that I need to upload to Git/Gist ?
I mean, I make a Config Task and save it. Now what?
Where is the Task saved? DB? File?
How to extract / upload that task to a Repo?
Oh sorry one moment.,…
Go to database tools and export file. Export the Config task and then copy the raw text thats in the file.
That is your gist… then you just link that file in your config.yaml So really the gists are already made for you all you gotta do is create the config.yaml entry for it. I say config.yaml but it really doesnt matter what you name the yaml. You can create one single yaml file with all your different tasks linked in it and all of them will show up in sambaPOS or you can create individual yaml for each specific task if you only want to share that one task.
Here is what my master YAML file looks like in my github. I have several tasks I made.
Items:
- Description: Automatic Print by Payment Type
Url: https://gist.githubusercontent.com/kendash/b989558b7150c44fe8c4/raw/
Version: 98
- Description: Advanced Split Payment
Url: https://gist.githubusercontent.com/kendash/9ada73d833dcc5517162/raw/
Version: 115
- Description: Time Clock
Url: https://gist.githubusercontent.com/kendash/99139acf1ab15af141e5/raw/
Version: 115
- Description: Activate Punch Editor & Add Employee
Url: https://gist.githubusercontent.com/kendash/a5635e86ab40504708ad/raw/
Version: 115
- Description: Allow Combo Meal Options
Url: https://gist.githubusercontent.com/kendash/ac3e8edaa588971b054413c146b587d2/raw/
Version: 132
It must be formatted exactly like that.
PS You can see my github gists here.
Ever seen this error when doing Rule/Action import from Config Task?
[Exception Info 1]
Top-level Exception
Type: YamlDotNet.Core.SemanticErrorException
Message: (Line: 26, Col: 50, Idx: 1135) - (Line: 26, Col: 54, Idx: 1139): While parsing a block mapping, did not find expected key.
Source: YamlDotNet
Stack Trace: at YamlDotNet.Core.Parser.ParseBlockMappingKey(Boolean isFirst)
at YamlDotNet.Core.Parser.StateMachine()
at YamlDotNet.Core.Parser.MoveNext()
at YamlDotNet.Core.EventReader.Allow[T]()
at YamlDotNet.Serialization.NodeDeserializers.ScalarNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(EventReader reader, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(EventReader reader, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(EventReader reader, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass2.<DeserializeValue>b__0(EventReader r, Type t)
at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(EventReader reader, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(EventReader reader, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(EventReader reader, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
I get that error when any Rule contains an Action that has a Custom Constraint …
Looking at the SP Task, I see Constraints are "double-quoted"
, so I guess the YAML code export is broken, at least in 5.2.2, because my YAML is not quoted …
The export does make mistakes sometimes. I had to manually correct a few. It’s almost always constraints.
I brought that up to Emre but more than likelly since it was only me using the feature he put it low on his list of things to fix