Updated 013 dynamicGet (markdown)

Amigo 2019-07-15 17:32:10 +02:00
parent cc1700dbba
commit 33f6781ce7

@ -2,10 +2,14 @@
### Sermon - Preacher Get Example
[00:00:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
We are still working with Sermon Distributor; we are going to use Preacher, a 'get' I've already set up as an illustration. Here we have 'Back-end view' selected. (See video.) [00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) For example: Select nothing. This is how it will usually look when you start. Select this, (depending on which area of the back end you want to get the data from) and select back end view. That is the best way to do it. [00:00:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s)
### Dynamic Get Source Selection
[00:00:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m50s)
The Joomla database option gives you the access to draw data from any other component installed that moment in the Joomla Website. [00:01:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m01s) If you select your Joomla database, you can select any database that is installed on your database at the stage. This means that you can reach out to other components through this dynamic get. [00:01:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s)
This is an area that I haven't tested well yet. You might try to implement it and run into some trouble. For now it is better to use the 'Back-end view' option. [00:01:42](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m42s) The other option is there is because we want the feature in the application even while we are still working to improve it. If not very complex mapping is done (for instance, if you do a simple direct database fetch like 'cb_associations') you will be able to use this and there won't be any complications. [00:02:09](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m09s) These other linked or joint database structures makes it complicated. [00:02:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s)
@ -14,24 +18,34 @@ There is also the 'Custom' option, using Component Builder to write your PHP for
### Dynamic Get Preacher View
These are the fields inside the 'Preacher' view. Load it and place this as 'asset_id'. (See video.) It is suggested that you don't change that. [00:03:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) You can remove a row if it is not needed, but what remains is the data you might want. This would be the variable name of the data when the get is used. [00:04:13](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s)
[00:03:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m32s)
These are the fields inside the 'Preacher' view. Load it and place this as 'asset_id'. (See video.) It is suggested that you don't change that. You can remove a row if it is not needed, but what remains is the data you might want. This would be the variable name of the data when the get is used. [00:04:13](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s)
### Get Types - Get Item/List Get Custom
[00:04:23](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m23s)
There are four getTypes: 'getitem' which will get one item from the 'preacher' table and 'getlistquery' which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) (Depending on how many items you want to get from the database, select either 'getitem' or 'getlist'.) Then 'getcustom' and 'getcustoms', plural. The difference between these four is that you will only use the 'getitem' once per view. [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s)
If you are building a custom admin view, you will select a main 'get', either of a 'getitem' or either of a 'getlist'. You can add multiple 'getcustom' item or 'getcustoms' items. This can be seen as other methods that can be added to the page, but it's not the main method. [00:05:30](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m30s) You have main methods:'getitem' and 'getlistquery', the exact naming of the methods that will be used. Then you have this 'getcustom' and 'getcustoms', which is almost the same as those two, except that they aren't 'main'. There will be another method in the model bringing data to the view. [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) You can add as many 'getcustom' and 'getcustoms' methods to your view as you like, but you can only add one 'getitem' and one 'getlistquery'. To determine this is to ask what the main objective of the view is. What is the main dataset that needs to be used in the view? That is what the 'getlistquery' and 'getitem' respectively are going to be used for. [00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
### Get List Pagination
[00:06:29](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m29s)
If the main purpose of the view is to show a list of preachers, 'getlistquery' is used as the main selection. When a 'listquery' is done, there is an option of adding pagination; it decides whether the data should return a certain number. Joomla has a global number which can be set in the system administrative area under 'Global' settings. [00:07:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) Go to 'System', then 'Global configuration' where there is a 'Default list limit'. This will be used as the amount limiting the data being returned to the page. It will only return twenty items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set the pagination to 'no', it will load all the data. 'Yes' would only load some of it, and 'no' will load all of the data, depending on what you want to do. If it to do an Ajax, be sure all the data is being loaded every time; if you'd rather use JavaScript to set up pagination for your view, use the 'no' switch. Most of the time just say 'yes'. [00:08:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) Component Builder will automatically add the pagination code to the page. It will also automatically add pagination code to the model at the bottom of the page; it will show a 1, 2, 3 pagination, depending on the template you are using and the styles that are on the page. If bootstrap is not on the page, the 1, 2, 3 might not look right and you might need to add styling to it. [00:08:31](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m31s) Component Builder doesn't know what style is on your page so it cannot make provision for this, but it can load the pagination itself.
### Join Data Views - Tables
[00:08:47](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m47s)
In this area is data. (See video.) This data can be joined to other database tables. In this area, as with the main source, it is possible to select joint views from a table. (See video.) [00:08:57](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) A view table is the views of the component or any database table. One of the database tables is categories. Component Builder integrates its application; if you add a category field to any view, it dynamically sets up a category for your component and integrates the category concept into your component. [00:09:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m22s) It writes all the code; Joomla's own applications, like Article Manager, does it. Your component is going to do it the same way Joomla article manager is bringing categories into the articles. Here at 'DB Table - cb_categories' you can select categories. (See video.) [00:09:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m54s) In the 'Selection' area the data can be modeled. 'Model' is meant to decide what needs to be returned, as not everything needs to be returned from categories.
### Joint View Tables
The Joint View Table makes it possible to select from any other views that are part of your component. [00:10:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m25s) You can select it to return a single row or a list of rows. If single row is chosen it will join it to the other data set you have as your main data or main source. It will be another item in the array. For example, that is why 'Name' cannot be used in this instance. (See video.) [00:10:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m51s) It needs to have the series_ in front of it so that it doesn't clash with the other data set that might have a value called 'Name'. So, if anything is selected here, it will populate this area with all the fields in that view. (See video.) [00:11:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m21s)
[00:10:23](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m23s)
The Joint View Table makes it possible to select from any other views that are part of your component. You can select it to return a single row or a list of rows. If single row is chosen it will join it to the other data set you have as your main data or main source. It will be another item in the array. For example, that is why 'Name' cannot be used in this instance. (See video.) [00:10:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m51s) It needs to have the series_ in front of it so that it doesn't clash with the other data set that might have a value called 'Name'. So, if anything is selected here, it will populate this area with all the fields in that view. (See video.) [00:11:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m21s)
Concerning the 'AS' button:
The same alphabetic number may not be used twice in the whole query. The whole get function can only use 'a' once, 'b' once, 'c' once, etc. [00:11:40](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m40s) Provision has been made up to zz. That is the quantity of tables there may be in this area 'AS'.
@ -43,6 +57,8 @@ The unwanted fields can be removed but the string should not be edited as it may
### Dynamic Get Preacher In Code
[00:14:52](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m52s)
Where is the code is written? If we are looking into sermon 'preacher id' we'll get to why it says 'preacher id' and we'll look at the 'filters' and the 'where'. [00:15:06](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m06s) Refresh the page, then go to the code. Since 'get' is used in the front of the component, go to the front end of 'sermon distributor', not the admin area. The dynamic get is used in the model to get the data. [00:15:33](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m33s) It's getting a list query and using pagination getting all this. (See video.) [00:16:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m02s) In the code the main method which has this id(a.name) or the data set may be seen. (See video.) You can see 'id', 'asset', 'name', 'alias', 'link', 'types' and 'short description'. [00:16:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m26s)
If you look at the UI it says the same things. It writes it here, showing you where in the compiler it has been done. It sets up the second one; 'series' saying 'series = c.id''. (See video.) [00:16:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m50s) It also tells you what it wants from 'c': the 'name', the 'alias', and a series name changing it to 'series' since this is in the select query. [00:17:12](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m12s) This array, 'array'(c.name)','c.alias' transposes to this array 'array'(series_name','series_alias'). That is how to use Joomla's database API. It has 'quotename', which you can pass to arrays, the first array being the name of the value, which in this case is 'name' and 'alias'. [00:17:35](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m35s) The second array is what is needed once the query is completed. It links this into the the query one-by-one. (See video.) All of those, even the category one, is linked in here. [00:17:59](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m59s) It checks for an id. If it exists, it checks whether it's a string. If it's a string, it adds a quote. If it isn't but a number, it adds it directly. That is where the query is done. Return false if there is no id. [00:18:23](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m23s) This is done through 'filtering' and 'where'.
@ -53,32 +69,43 @@ When we look at the site layout area and the templates I'll talk about this tran
### Dynamic Get Custom Script
Returning to the dynamic get. A custom script area can be seen. If you click on it, there are different switches. [00:21:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m54s) You can select 'getlistquery', 'before getting the items', or 'after getting the items'. If you select 'after getting the items' and place code there, data gets dumped right after the initial items you received. [00:22:14](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m14s) It will add the code in there and return the items. That is why you can model the data in the dynamic get; write the code for the data after it had been 'get'. If this code had been removed, it will indicate if there is an array of items where all values are. [00:23:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) Make sure those items are set and there. (A 'string bracket component helper function' is used to check whether the string is there.) Some nice PHP can be dumped here. Even before getting the item you can add some filters or get list query if this is model list. If it is item, there's a different set of switches is available. It adjusts to the type of query up here. [00:23:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m19s)
[00:21:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m48s)
Returning to the dynamic get. A custom script area can be seen. If you click on it, there are different switches. You can select 'getlistquery', 'before getting the items', or 'after getting the items'. If you select 'after getting the items' and place code there, data gets dumped right after the initial items you received. [00:22:14](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m14s) It will add the code in there and return the items. That is why you can model the data in the dynamic get; write the code for the data after it had been 'get'. If this code had been removed, it will indicate if there is an array of items where all values are. [00:23:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) Make sure those items are set and there. (A 'string bracket component helper function' is used to check whether the string is there.) Some nice PHP can be dumped here. Even before getting the item you can add some filters or get list query if this is model list. If it is item, there's a different set of switches is available. It adjusts to the type of query up here. [00:23:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m19s)
### Dynamic Get Join DB Tables
[00:23:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m20s)
Coming back to the 'Join View Tables' area. Let's look at the database table option. If category is selected and it's a single row that is returned, it is called 'b'. It is joined to the left, and set 'a.catid' to be equal to 'b.id' which is the ID of the category. Only a title and alias is needed. That is how this is set up. [00:23:44](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s) Only the title and the alias are necessary and has been returned. It links it in there which is part of what is seen here when viewing the query option, the sixth section. (See video.)
### Dynamic Get Filters - Where - Ordering - Globals
Here is a 'filter', a'where', an 'ordering' and a 'setting' of globals. [00:24:12](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m12s) The 'setting' of globals: if you have a value in this query that you want to use in a custom query (which isn't setup yet, but you want to know if this value is needed in the model) then, through this global option here, a global area can be set. It could be tested here. (See video.) There is an option to use 'This' and 'State'. [00:24:38](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m38s) It is the different set types. You can set the value to 'State' or the value to 'This'.
[00:24:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m04s)
Here is a 'filter', a'where', an 'ordering' and a 'setting' of globals. The 'setting' of globals: if you have a value in this query that you want to use in a custom query (which isn't setup yet, but you want to know if this value is needed in the model) then, through this global option here, a global area can be set. It could be tested here. (See video.) There is an option to use 'This' and 'State'. [00:24:38](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m38s) It is the different set types. You can set the value to 'State' or the value to 'This'.
It is necessary to know the key. For example in this case, if 'name' is used it won't work because there are more than one name. Usually this global function only function well when you return a single item. [00:25:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m01s) When 'getitem', not 'getlistquery', is done you can give it a name because it makes sense. It won't add it to the global scope of the model that you can access through other model methods which are custom methods. [00:25:24](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m24s)
There is a list of possible filtering. Depending on what needs to be done any of these may be selected. (See video.) [00:25:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m45s) Some of them aren't formulated yet. 'Date', for example, doesn't work well yet. These do: 'Categories', 'user', 'group', 'access level', 'user' 'id', the function 'variable', array', 'value', 'repeatable value'. (See video.) You can use and implement them. [00:26:15](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m15s) To know how it works some knowledge of PHP is needed. You need to compile it and look in the code what it has done and where it placed what. That is why this is all set in the model. For example, we wanted to do a 'JRequest::getint by id'. [00:26:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m39s) This is the get area that has been added. In the code you will see 'State Key' and 'JRequest::getint by id'. It is a function variable; it does not change or adapt this at all. It indicates that it must be equal to 'preacher'. Since Component Builder doesn't know if this variable is going to be a string or integer, this function has to check if it is a string or a number and then build up the query respectively. It is the only way to implement it at this stage. [00:27:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m08s)
### Dynamic Get Access (Default added)
We have a bunch of values that fire every time in a custom dynamic get model. [00:27:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m39s) You might need these values. (See video.) Instead of doing custom scripting to get these values on the page, these values gets dynamically added every time. The 'userid', the 'group', the 'authorised group', the 'access level', the 'app', and the 'input values' are on the page by either URL or post; it indicates that it has been initiated, and set it to true. [00:28:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m08s) If you have custom methods, like 'getpreacher', it checks whether it had been set. If it had, it does not set it again; it is ready to be used. But if it hasn't been set, it sets it, and again sets it to true. [00:28:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m32s) These global variables can be used inside the code like the global variable we spoke of earlier. Out of that global variable we access the 'levels', which has the get authorized view levels of the specific user that has now accessed this model or the view this model belongs to. If it is in the access levels. [00:29:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m00s) 'Public' is another access level. If the user isn't signed in, he is 'public'. This will validate true in the query. Set it up by adding access level in 'a.access'. [00:29:28](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m28s) Check in the main source table for 'a.access' if the user is there. So you don't need to add a 'state key' because the code is done for you. [00:23:44](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s)
[00:27:38](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m38s)
We have a bunch of values that fire every time in a custom dynamic get model. You might need these values. (See video.) Instead of doing custom scripting to get these values on the page, these values gets dynamically added every time. The 'userid', the 'group', the 'authorised group', the 'access level', the 'app', and the 'input values' are on the page by either URL or post; it indicates that it has been initiated, and set it to true. [00:28:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m08s) If you have custom methods, like 'getpreacher', it checks whether it had been set. If it had, it does not set it again; it is ready to be used. But if it hasn't been set, it sets it, and again sets it to true. [00:28:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m32s) These global variables can be used inside the code like the global variable we spoke of earlier. Out of that global variable we access the 'levels', which has the get authorized view levels of the specific user that has now accessed this model or the view this model belongs to. If it is in the access levels. [00:29:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m00s) 'Public' is another access level. If the user isn't signed in, he is 'public'. This will validate true in the query. Set it up by adding access level in 'a.access'. [00:29:28](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m28s) Check in the main source table for 'a.access' if the user is there. So you don't need to add a 'state key' because the code is done for you. [00:23:44](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s)
### Dynamic Get "Where"
You can add any table key equal to a certain value. [00:29:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m48s) The value could be another table like "b.field" or it even a global variable, like we said we can set up. It can also be an 'userid' which is already on the table. It could be done as in this case, only an integer, '1'. It is important to make sure that all the sermons returned are published. [00:30:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m18s) If you have an unpublished sermon it won't be returned at all.
[00:29:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m48s)
You can add any table key equal to a certain value.The value could be another table like "b.field" or it even a global variable, like we said we can set up. It can also be an 'userid' which is already on the table. It could be done as in this case, only an integer, '1'. It is important to make sure that all the sermons returned are published. [00:30:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m18s) If you have an unpublished sermon it won't be returned at all.[00:27:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m39s)
### Dynamic Get Ordering
To set up a 'getlistquery' with pagination through this ordering method use the 'a.ordering' and send. [00:30:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m39s) You can order all the items. Add many as you like. Be sure the table that you ordering could use a name. It could be a 'name', as in an ordering table key. You can do descending or ascending which would be added to the query. [00:31:03](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m03s) It also added ordering to the data set from your dynamic get method. With the joint view tables you can do dependency calls from other tables in the back end, bringing the data together into one items array. [00:31:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) That's what dynamic get is for. There is a main source on the model.
[00:30:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m32s)
To set up a 'getlistquery' with pagination through this ordering method use the 'a.ordering' and send. You can order all the items. Add many as you like. Be sure the table that you ordering could use a name. It could be a 'name', as in an ordering table key. You can do descending or ascending which would be added to the query. [00:31:03](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m03s) It also added ordering to the data set from your dynamic get method. With the joint view tables you can do dependency calls from other tables in the back end, bringing the data together into one items array. [00:31:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) That's what dynamic get is for. There is a main source on the model.
'Getpreacher' is another dynamic get function we looked at. [00:31:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m45s) If it is opened, it is a 'getcustom'. Its custom name is 'getpreacher'. These are its relationships; in this instance it does not have any relationships or links to other tables. (See video.) [00:32:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m04s) It gets the preachers details right here, but has a filter which uses the same integer and access levels as the filters. (See video.) It uses a 'where'; it can be seen that it is published and that it does not need ordering, because it is one preacher. [00:32:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m41s) It doesn't have any global settings. From these settings, Component Builder writes all this code. We use this function called 'UIkitComp' and a global static method, 'getuikitcomp'. It's a method that VDM built. To get more acquainted with Uikit, google 'getUIkit'. It's a CSS JavaScript library, which makes the modeling of your views easy. It has components that you can use, like tool tip andall, etc. [00:33:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m45s) Guardian is another component. But not all of its components are loaded every time.