Forum Discussion

Re: What is the Hylo Technique?

This is an excellent and timely question!

In a nutshell the Hylo Technique is a general technique for placing a button on a parent record which when clicked will add a set of child records initialized according to your specific needs. A typical use case might be to add a set of child tasks with fields initialized to specific dates, counters or names but the technique is so generic it could accommodate a lot of other possibilities and custom business logic.

Why is it called the Hylo Technique? Well Hylo is short for Hylomorphism a concept drawn from Category Theory and probably one of the most abstract areas of modern mathematics. What I love about QuickBase is that is a great platform for learning about Category Theory and other super abstract mathematical concepts. Heck if QuickBase marketing is going to push this Low Code Citizen Developer meme I am going to promote Category Theory - we have got to have some balance and clarity in our QuickBase work since math is everywhere including within QuickBase:

Numb3rs Scene: Everything is numbers, Math is everywhere
https://www.youtube.com/watch?v=vFRTgr7MfWw

So this is how I will cast the problem: Let's you have set of parameters say {Base Date, Frequency, Number} associated with some parent record and you want to automatically create a set of child records and initialize the child records based on these parameters. For example if the Base Date was "6/9/2016", the Frequency was "Weekly" and Number was 5, and the Parent [Record ID#] was 56 we would want to create child records based on this string of CSV data:

[Date], [Related Parent]
6/9/2016, 56
6/16/2016, 56
6/23/2016, 56
6/30/2016, 56
7/7/2016, 56



You can think of this as a two step process: 

First, let's generate a list of data for the child records from the parameters basedate, frequency and number. Generating a list from a set of parameters is called an unfold or anamorphism in Category Theory.

Second, let's take our list of data for the child records and condense it into a single string representing the CSV data we need to import to create the child records (using API_ImportFromCSV). Generating a single value from a list is called a fold or catamorphism  in Category Theory.

When you perform an unfold followed by a fold this process is called a Hylomorphism in Category Theory. So now you know that when you are want to create a set of child records from a button push based on a set of parameters associated with the parent record you are basically performing a Hylomorphism. What could be more simple?

So here is the demo I promised:

Hylo[morphism] Technique
https://haversineconsulting.quickbase.com/db/bkw2ff3e3?a=q&qid=1


Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=511

Notes:

1) The demo has been set up so you can create parent and child records. Bear in mind that other users may have created records before or during your visit to the application. 

2) Clicking the "Sans Dialog" button will create records according to the field values in the parent record. Clicking the "With Dialog" button will ignore the field values inthe record and prompt you to enter similar parameters through a popup dialog.

3) Using the "Sans Dialog" button field values are passed to the moduleParents.js script using data attributes.

4) Using the "With Dialog" button parameters (basedate, frequency, number) are solicited through a jQueryUI Dialog widget. Further, the basedate used the jQueryUI Datepicker to select a date.

5) This demo uses the AMD module for momentjs to perform date calculations. QuickBase has already declared this is an AMD module so all we do is requre it in the script.

6) With either button after the child records are created the script will redirect to a view of the parent record with an embedded list of child records. Your newly create child records will be displayed among the records of the embedded report.

7) This script is quite general and could be modified in many ways to implement other requirements and business logic.

8) In case you are wondering a fold followed by an unfold is called a metamorphism in Category theory.
No RepliesBe the first to reply