The template engine uses JSP style <% %> and <%=%> expression or Gstring style expression. The JSP style/Gstring Style coding reminds me of asp/php- and C coding. On one of the webpages , i found an example. For instance <%= firstname %> is replaced with a instance of a firstname and ${accepted ? ‘accepted’ : ‘rejected’} reminds me of C coding ( if accepted then ‘accepted’ else ‘rejected’).
When you want to edit the templates it's not advisavle doing this directly in the database (like i did initially) but with the ‘back end web GUI’ (http://localhost:8080/qp/). Starting this url will show the following window:
With this window you can browse the different available controllers in Quipu. On the left screen the numbers of controllers and the number of domains are shown. The number of available controllers on the window, is equal to the number of domains (33). Domains are a subset of controllers?
I already inserted a record (808) in the database (before i knew that there was a front end available) : SQL dialect ANSI SQL 92 Custom. Lets take a look into this template by clicking on ‘808’:
And here you can see the template. The next thing we can do is trying to modify the Groovy template by pressing ‘Wijzigen’.
And now it’s possible to edit the template text. I installed notepad++ on my VM and copied the Groovy template in notepad++:
And this template generates the following ANSI SQL code:
Okay, let’s try to change this script into something like this (DROP/CREATE Stored procedure):
At first i was a bit ambitious about creating to many code at once and the following error occurred :
After some debugging of the code, i managed to create a new template with the DROP/CREATE Stored procedure.
So this template creates stored procedures in SQL Server.
Conclusion:
- Debugging the code is a problem. Editing the code in notepad++, copy the code in the Quipu back end, generating the stage (or datavault) and then hoping that it will execute, is a labour full job. If a name of a object is miss spelled, it will still execute and a null appears in the generated code. The coding would speed up, if there is some sort of direct feedback whether the code is correct (intellisense?).
- I think that the names (of the fields of the table) are equal to the objects/properties. Still, it would help if the objectmodel and their properties is described.
Overall, it is great to have the ability to edit the templates and generating all kinds of code. Anything is possible! Mastering Groovy is inevitable to create powerful scripts.
Perhaps it should be possible to write the generated code into a file or a database. At this moment, there is an extra step involved: retrieving the generated code from the qp_sql_step table or copy the generated code in a tool, for instance Integration Services.
Greetz,
Hennie
Zijn er ook bepaalde redenen te bedenken waarom je de standaard templates wilt aanpassen? Ben je niet bang dat je dan de standaard datavault methodiek verandert doordat sql code niet meer conform dv is?
BeantwoordenVerwijderenHi Ronald,
BeantwoordenVerwijderenGoeie vraag. Niet zozeer Datavault methodiek zou ik willen aanpassen, maar dan wel de vorm waarin de Datavault wordt gegenereerd door Quipu.
Gr,
Hennie