CONTENTSTART
EXCLUDESTART EXCLUDEEND

New Tools

Tools tools tools, everyone loves tools!  Tools help you build stuff, do stuff, and better tools mean you can do more with less time and less hassle.  Well, I finally got around to publishing some new tools for you to help you develop your sites.  In this article, I’m going to go through the new tools, explaining my thought processes behind them, along with some great application examples.

Updates First

One thing that most people find annoying with Kentico Marketplace submissions is that someone will submit a cool new tool (yay!) but then they never update it, or they only publish it in 1 version of Kentico (boo!) and usually it’s the version that you aren’t on (darn you murphy….).  I try to not do that to you, because I love you all, so I keep my tools up to date as well as convert them to the latest versions of Kentico.

That being said, it isn't easy converting all my new tools to each version of Kentico.  Right now each time i develop a tool, I need to import it, adjust it, and export it to Kentico 8, 8.1, 8.2, 9, and 10.  It took about 4 hours to convert these latest tools and do all the exporting.  So once Kentico 11 comes out, I’m going to drop support for new development for 8, 8.1, and 8.2, unless someone requests a tool be converted to an older version.  So new tools will be in 9, 10, and 11.

Bootstrap Layout Tool

I’ve published an update to the Bootstrap Layout tool after some user feedback.  The majority of the tool remains the same (because it’s awesome, right?!), but I’ve removed the div tag that used to exist between the “row” and the “column” divs.  Now it renders normally.

<!-- Before -->
<div class="row">
	<div>
		<div class="col-sm-3"></div>
		<div class="col-sm-9"></div>
	</div>
</div>

<!-- Now -->
<div class="row">
	<div class="col-sm-3"></div>
	<div class="col-sm-9"></div>
</div>

I’ve also adjusted the Bootstrap Helper CSS to remove the color shadowing as it would interfere with copy and pasting HTML from that section, and added a Design Mode class that added a 35px buffer on top for the widget form of it so you can easily configure the widgets, as the widget menu would otherwise hide under the bootstrap widget menu.

Advanced Category Selector

I've also made a couple updates to the Advanced Category Selector, fixing a couple bugs that some users encountered, and adding a new feature: Many-to-Many table support.  Now you can decide to save your Item to Category relationship in a separate table (say a module table), and not use the CMS_DocumentCategory table.  This expands the usage of the Categories to more than just Documents, along with for massive structured projects to place your different type of Categories into different tables for better query optimization.  Just note that if you plan to use a custom Module Class/Table, and you wish it to leverage your class's generated Info class, you'll need to modify the Advanced Category Selector in 2 spots that are clearly marked in the code.  Very easy to do.

Onto the New Tools

Now onto the new tools.  Now I must preface this, that if you are reading this upon launch, some of these tools are not up on the marketplace just yet.  Kentico has a very strict processes that they make sure modules are bug free, secure, and well documented.  The well documented is often the hold up as my tools are often developer focused so not exactly 'user friendly' for the novice user. 

CSV Import Tool

Let me tell you a tale about a CSV importer.  This import tool was great when it was new, but sadly it never grew up as the years went on, and remained only Kentico 7 years old. Long abandoned by its parents, it sat there, alone in the marketplace, never to be used again.  Which was sad because people loved to use Excel to manage large amounts of data, being able to easily edit records, add new ones.  But the sad little CSV importer could no longer be used.  The end.

Sad tale, right?  Well things are different now.  Seeing that the existing CSV Import tool was never migrated to other versions, I decided to create a new one, a better one, one that was more Kentico-ish. 

First, let's cover what was wrong with the first one (Besides never being ported to the newer Kentico versions).

  1. Only Custom Table Support: Sadly, only custom tables were usable. No love for Forms or Custom Module Tables
  2. No API Support: Any changes that were made were done through dynamic SQL, meaning no staging tasks would be created, no event hooks triggered.
  3. Only Mass Delete/Upload: The old CSV tool would only allow you to remove all items and replace them.  Which if you ever had any Row ID mappings or such, the relationship would be lost each time you used it.

So when I created the new tool, I fixed all those things.  The new tool supports Custom Tables, Biz Forms, and Custom Module Classes.  The new tool also leverages the BizForm and CustomTable classes when inserting/updating/deleting records, so Event Hooks are triggered.  For Custom Modules, it out of the box generates dynamic SQL for insert/update/delete, but more importantly you can modify the importer code and add in your own generated Info/InfoProvider classes so even your Custom Module Classes will have full API support.

I also added a CSV export of the data so you can get all the existing data and structure, with Auto Mapping.  You can leverage Update and Delete indicator columns to indicate if a record should be updated or deleted (by putting a Y/Yes/True/1 in the indicator column).  This way you can upload a 100 record CSV but only have a couple items updated/Deleted.  Rows in the CSV without a Row ID are treated as new and are inserted.  You can also let the system handle auto-generated columns such as Last Modified, Item GUID, and ModifiedBy.  You can additional tell it to do a mass delete before uploading if you wish.

How does it do all this?  Each Table in Kentico has an Info class.  Each Info class inherits from the BaseInfo which allows you to GetValue and SetValue entries.  Each class also has a structured XML in the CMS_Class table that defines what fields exist and what type they are (text/ bool/int, etc).  With these pieces of information, it can create the columns to map to, know how to convert the CSV's text value to the proper column type, set the item's value and update/insert/delete them. 
Applications are obvious, giving the users the ability to handle massive amounts of data in an Excel like fashion.

This is almost ready for the marketplace, and should be there shortly for 8 through 10!

Advanced Many-To-Many Selector

This tool is another great tool for Modules.  Like the Many-To-Many feature in the Advanced Category Selector, this tool allows you to maintain many-to-many relationships between the current object and any other object.  You define the joining table and the references and it takes care of the rest.  This handles inserts/updates/deletes of these relationships, only modifying the things that need to be modified. 

This tool is great for custom development, or anywhere where you need to select multiple of 'something' for a given item (such as maybe multiple states a Dealer can show up for, or multiple Users a person manages). 

As for handling hooks and eventts, his uses the API for Custom Table relationships, but for Custom Module classes you'll need to generate your Info Class and modify the code at the designated spots in order to use it for join table support.

Universal Page/Query Filter

By now you're probably like "Why does he name everything Advanced ____ or Universal ____"?  Well...it sounds cool.  And really, that's what I create my items to be, usable universally or advanced in their functionality.   These filters are no different!

Page and Query Filters pretty much do the same thing; they generate a WHERE Condition or ORDER BY condition that is passed to a Page/Query Repeater or Data Source.  The only problem is; you have to develop your own Filter to generate that WHERE or ORDER BY.  But most filters are pretty much the same, a single drop down or radio list that a user selects, that then does something to your data source / repeater.

These filters allow you to select either a Drop down or Radio List, define the source (much like you would define one normally, a List, a SQL Query, or Macro object), Define how it looks and what value is set for the values, and then the last piece was how the selected value would interact with the query.  I leveraged the Macro Engine to allow you to write up the WHERE Condition, passing the selected Value as a macro value that is rendered dynamically.  So now you can do all this without touching code.

The only limitation is you can only have 1 filter per Data Source, so if you need multiple elements, you'll be stuck creating a custom Filter, but for single element filters, this will do the trick without touching code.

Applications could be say a Product Listing where you want the user to be able to select a department, and show the Products in that department.  You can add this, set the data source to a query of the departments (setting the value as the departmentID), and then the WHERE condition would be something like "DepartmentID = {% Value %}"

Multiple Child Form Control

This last one was built out of the need to have a Form, but allow a "Many" sub item or form to it.  Forms by default in Kentico are a table, which means you have a specific column structure.  Some people have had to add a "Value_1, Value_2, Value_3, Value_4...." to try to accommodate a certain number of values a user may pass, but this is not only limiting (because maybe they need 5 values and you only accounted for 4), but also bad data structure as you end up with a ton of empty space.

So this tool here allows you to select another form as a child element.  As long as the other form has a "ParentID" type of column that you designate, it allows you to enter as many child form elements to your main form, and upon validation and saving, it will create those children and set the ParentID to the parent Form's ID.  You'll need to use macros or custom logic to pull in the data on the generated Emails of course, but that's all doable.

The tool also allows you to define the buttons, button placement, and has a couple "Before" and "After" html spots so you should be able to design the layout as you want to accommodate any listing.
This tool leverages Kentico's Form control, which you can pass it an Object type and Form Name, and load an existing form data into it for updates.  It dynamically adds these Form elements to your form, setting the proper values, and upon save handles them and adding the associated ParentID.

Applications are for any form that allows a "+/-" of certain elements or groups of elements, such as a form where you add your trip expenses (where you need to add many expense items for the trip).
 

Conclusion

The new tools should be on the marketplace within a couple weeks, otherwise shoot me a message and i'll send you what i have so far.  I'll also get the Resource center updated once they are up there to provide some more links and references.  

Please give me some feedback on the tools, and if you find any bugs, report them to me and i'll get them fixed up.

I'll also get all these updated for Kentico 11 as soon as it rolls out, so keep an eye out!

Comments
Blog post currently doesn't have any comments.
Is one < than one? (true/false)
CONTENTEND