Updated 013 dynamicGet (markdown)

Amigo 2019-06-17 17:11:16 +02:00
parent 988624a5fb
commit 901915a9d7
1 changed files with 12 additions and 13 deletions

@ -8,13 +8,13 @@ We are still working with Sermon Distributor; we are going to use Preacher, a 'g
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 tun 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)
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)
There is also the 'Custom' option, using Component Builder to write your PHP for you. At 'custom Get' you can add custom PHP, that will add the methods data for you. This is a 'custom get' option where you write the code by hand whereas this 'Custom - dropdown' option writes the code for you. (See video.) [00:02:55](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) Select the Back-end view that you want to use; it will be the view that you connect to your component. Type your name in here, select the package, and it will load all the field names. [00:03:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s)
There is also the 'Custom' option, using Component Builder to write your PHP for you. At 'custom Get' you can add custom PHP that will add the methods data for you. This is a 'custom get' option where you write the code by hand; whereas this 'Custom - dropdown' option writes the code for you. (See video.) [00:02:55](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) Select the Back-end view that you want to use; it will be the view that you connect to your component. Type your name in here, select the package, and it will load all the field names. [00:03:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s)
### Dynamic Get Preacher View
These are the fields inside of 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)
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)
### Get Types - Get Item/List Get Custom
@ -23,34 +23,33 @@ If you are building a custom admin view, you will select a main 'get', either of
### Get List Pagination
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 to 'Global configuration', there is a 'Default list limit'. That is what will be used as the amount limiting the data being returned to the page. Here it will only return twenty items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set that 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 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, that 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 all of that. But it can load the pagination itself.
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
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 it's 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 and Joomla's own applications, like Article Manager, does it. It's uses the same conventions. If you know how Joomla article manager is bringing categories into the articles, that is the way your component is going to do it. 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.
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 of the 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 be selected it to return a single row or a list of rows. If single row is chosen it will join it to this other data set that you have as your main data or main source. It will be another item in the array. For example, that is why 'Name' can not 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 that series_ in front of it so that it doesn't clash with the other data set that might have a value called 'Name'. For example, 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)
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)
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'.
Decide what type of return this 'Return Row Type' have to be. If it is set to multiple, these names will automatically update. [00:12:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m02s) The get method will create a new method getting this data and adding it into your item list via this relationship. I'm adding the 'On Field' as the '.a' series; that is where the 'id' is for the series. [00:12:24](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m24s) In the joint field, 'c.id' is used. In the main database, that is the 'a' database. There must be a field called series. It has the id of the series. It corresponds to the id in this list. If it is necessary to return a multiple, the main database, in this case 'Sermon', can be linked to multiple series's. [00:12:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s)
In this system a sermon can only be connected to one series; it is certainly a single return. It will then immediately add this 'series_' in front of everything to insure it doesn't clash with your 'a' table. [00:13:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m18s)
The unwanted fields can be removed but the string should not be editted as it may possibly malfunction .Some further development still needs to be done in this area. We want it to be possible for you to change this name to anything you like. We are going to try and do that eventually. You can be changing it but it will still write it this way in the code. [00:13:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m54s) It will drop the fields you don't select. If you say that you don't want these, then it won't get those fields and you will only have this data returned. Again here you can have equal, not equal, equal or not. We also have 'IN' function. [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s)That means if this 'On field' is an array, then you can use the 'IN' function to make sure that it actually looks whether the ID is in this array. That's the 'IN' function. [00:14:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
In this system a sermon can only be connected to one series; it is a single return. It will immediately add this 'series_' in front of everything to insure it doesn't clash with your 'a' table. [00:13:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m18s)
The unwanted fields can be removed but the string should not be edited as it may malfunction. Further development still needs to be done in this area, making it possible to change the name to anything you like. At the moment you can change it but it will still write it this way in the code, dropping the fields you don't select. [00:13:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m54s) If you say that you don't want these, it won't get those fields and only this data will be returned. Again, you can have equal, not equal, equal or not. We also have 'IN' function. [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) If this 'On field' is an array, you can use the 'IN' function to make sure that it checks whether the ID is in the array. [00:14:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
### Dynamic Get Preacher In Code
Where is the code is written? If we are looking into sermon 'preacher id'. We'll get to why it says 'preacher id', when we look at the 'filters' and the 'where'. [00:15:06](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m06s) Let's go to the code. First refresh this page, and then go to the code. Since this 'get' is used in the front of the component, we will go to the front end and not to the admin area. Go to the front end of 'sermon distributor'. 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 it's using pagination getting all this. [00:16:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m02s) Going into the code, the main method which has this id(a.name)or the data set may be seen. It is written here(selected area on video). Here 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)
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, 'alias', 'link', 'type', 'short description', 'icon', 'preacher', 'series', 'category' and 'id'. This is where it writes it. It shows you where in the compiler it has been done. Then it sets up the second one; 'series'. [00:16:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m50s) It says; 'series = c.id''. So series, there(see video) is 'series', '=', the 'c', 'this table', 'series' and 'id'. Then it also tells you what it wants from 'c'. It wants the 'name' and the 'alias' and then it wants a series name that changes it to 'series'. [00:17:12](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m12s) Since this is in the select query. This is one function there. That 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 a thing called 'quotename', which you can pass to arrays.[00:17:35](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m35s)The first array being the name of the value, which in this case is 'name' and 'alias'. The second array, is what is needed once the query is completed. So it links this(selected area on video) into the the query one-by-one. All of those even the category one is linked in here. Then [00:17:59](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m59s) it does a check whether there's 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, if it is a number, it adds it directly. That is where the query is done, here return false if there is no id. We'll look at this area in a moment. [00:18:23](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m23s) This is done through the 'filtering' and the 'where'.
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'.
A example of how it adds this preacher as well as series to the query:
If you look at the back, open up 'Join View Tables - Add', you will see that series and preacher [00:18:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m41s) and statistics. Multiple statistics are selected because for one sermon there can be multiple files, and there will be a number per file. [00:19:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m02s) It is first does the query and here in 'getitem', it adds a new function called 'getidSermonstatistics' and with a random key 'Fcff_E' to ensure that it doesn't conflict with any other method on the page. We had to add this 'Fcff_E' random key. It puts it into this variable. That something that you need to [00:19:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m27s) come and look at.
An example on how it adds the preacher as well as series to the query: In the back open 'Join View Tables - Add', to find series, preacher, and statistics. [00:18:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m41s) Multiple statistics are selected because there can be multiple files for one sermon. (There will be a number per file.) [00:19:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m02s) It does the query and in 'getitem' adds a new function called 'getidSermonstatistics' with a random key, 'Fcff_E', to ensure it doesn't conflict with any other method on the page. The 'Fcff_E' random key places it into this variable. [00:19:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m27s)
Possibly when we look at the site layout area as well as the templates, I'll be talking about this transition here again and the fact that you need to know that it is in this variable and I'm trying, inside of your layouts and your site views and these things, to give you the correct name. But it is not [00:19:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m51s) watertight correct. Possibly you need to come and check this if it doesn't work. I'll explain that when we get there. We're adding statistics into this(idsermonstatistic) variable through a method which is also on the page and we passing the ID of the sermon. If you look at UI for instance, and go to 'statistics', 'multiple' and [00:20:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m19s) join to the left. You can select any of these(dropdown'. Then use the main table 'a.id', it must be equal to 'e.sermon'. Then this is the only values that needs to return from the 'e.sermon'. The 'e.sermon' is this(see video) value here, and 'a.id' must equal with e.sermon. [00:20:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m48s) If you look at the code, if we go to this function(idsermonstatisticFcff_E), it takes the 'id' and places it next to 'e.sermon'. Here's the two arrays. What it is in the database, and what it should be now. It checks whether it got any arrays or any values. [00:21:17](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m17s) Then returns that as an object list, that then gets placed in this space.(See video)
When we look at the site layout area and the templates I'll talk about this transition again and the fact that you need to know that it is in this variable. I'm trying, inside of your layouts and your site views, etc, to give you the correct name, but it isn't watertight. [00:19:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m51s) You might need to check this if it doesn't work. We're adding statistics into this (idsermonstatistic) variable through a method also on the page and we are passing the ID of the sermon. [00:20:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m19s) Go to UI, 'statistics', 'multiple' and join to the left. You can select any of these. (See video.) Use the main table 'a.id'; it must be equal to 'e.sermon'. These are the only values that needs to return from the 'e.sermon'. The 'e.sermon' is this value here, and 'a.id' must equal with e.sermon. (See video.) [00:20:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m48s) In the code this function (idsermonstatisticFcff_E) takes the 'id' and places it next to 'e.sermon'. The two arrays are what it is in the database and what it should be now. It checks whether it has any arrays or any values, then returns it as an object list which gets placed in this space. (See video.) [00:21:17](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m17s)
### Dynamic Get Custom Script