Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi @wposner-2
Here is the code that i use to extract JS code and SQL code from the XML
docNew.XPathSelectElements($"//ThingShape/ServiceImplementations/ServiceImplementation").ForEach(codeElement => { var handler = codeElement.Attribute("handlerName").Value; var name = codeElement.Attribute("name").Value; if (string.Equals("Script", handler)) { // Javascript codeElement.XPathSelectElement("*//Rows/Row/code").WriteJS($"{entityFolderPath}/{name}.js", merge); } else { // SQLCommand, SQLQuery codeElement.XPathSelectElement("*//Rows/Row/sql").WriteSQL($"{entityFolderPath}/{name}.sql", merge); } });
You may need to extract mashup code, so that you would be able to track/merge UI changes
// Mashups docNew.XPathSelectElements($"//{entityCollection}/{entityType}/Things").Where(_ => _.HasElements)
.ForEach(codeElement => codeElement.WriteXML($"{entityGroupFolderPath}/{entityName}.xml", merge)); docNew.XPathSelectElements($"//{entityCollection}/{entityType}/mashupContent") .ForEach(codeElement => codeElement.WriteJSON($"{entityGroupFolderPath}/{entityName}.json", merge));
Hope this helps!
My Bests,
Hung Tran
@htran-21 Thank you! One final question. How are you merging your JS/SQL back in to to the XML so that it can be re-imported to TWX? I'm really hoping this is not a copy/paste operation :)
Hi @wposner-2
No, everything is automatic, just perform merge task, and the final XML would be merged with the latest local/remote changes
My Bests,
Hung Tran
Hi @htran-21 ,
I'm really interested with you tools. Based on your original post, I guess you wrote a bunch of tasks.
Would you share the source code ?
Thanks in advance,
Cyril
Hi Cyril,
Thank you for your interest. I think of packaging the solution in a Docket and deploy it as a cloud solution, a something similar to https://stackblitz.com/, but allow us to work with Thingworx projects.
My Bests,
Hung Tran
That sounds great !
Unfortunately, we just need this kind of functionality to ease GIT process and review code changes in services before committing.
We are developing on customer premises.
Cyril