From 070ce96ffb502842b6c3e222a914176fb2d053d1 Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Fri, 14 Jun 2019 15:53:14 +0200 Subject: [PATCH] Updated 013 dynamicGet (markdown) --- 013-dynamicGet.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/013-dynamicGet.md b/013-dynamicGet.md index 5549064..02c8b8e 100644 --- a/013-dynamicGet.md +++ b/013-dynamicGet.md @@ -19,25 +19,26 @@ These are the fields inside of the 'Preacher' view. Load it and place this as 'a ### Get Types - Get Item/List Get Custom 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 which are these 'getitem' and 'getlistquery', which is the exact naming of the methods that will be used. Then you have this 'getcustom' and 'getcustoms', which is almost the same as these two, it is just that they are not 'main'. There will only be another method in the model which will bring 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 need 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) +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 -If the main purpose of the view is to show a list of preachers, then 'getlistquery' is used as the main selection. When a 'listquery' is done, there is the option of adding pagination. That is to decide whether the data should only 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 that limits the data being returned to the page. In this instance it will only return 20 items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set that pagination to 'yes'. If I set it 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. Is it to do an Ajax, you want to be sure that all the data is being loaded every time or if you rather use JavaScript to set up pagination for your view, then that is why you would 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 possibly not look right and you will 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 actually 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 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. ### Join Data Views - Tables -In this area(see video) is data and this data can be joined to other database tables. In this area(See video) like with the main source it is possible to select joint views from a table.[00:08:57](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) A view table which is the views of the component or just any database table. One of the database tables I often connect to, 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) So it writes all that code and Joomla's own applications, like Article Manager does it. It's using the same conventions. If you know how Joomla article manager is bringing categories into the articles, then that is the way your component is going to do it. Here at 'DB Table - cb_categories' you can select categories. [00:09:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m54s) These switches, will be dealt with in more detail when this area will be discussed. In the 'Selection' area the data can be modeled . With 'Model' is meant to decide what needs to be returned, as not everything needs to be returned from categories. More about the Data Base(DB) later in this tutorial. +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. ### Joint View Tables -The Joint View Table, makes it possible to select from any of the other views that is part of your component. [00:10:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m25s) It can be selected whether it should return a single row or a list of rows . If single row is chosen, consequently it is going to join it to this other data set that you have as your main data or main source. It will just 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 possibly also has a value called 'Name'. For example, if anything is selected here(See video) 'Scaling Factor - dropdown', 'Series', it will populate this(Selection) area with all the fields that is in that view.[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 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) + 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 and then 'b' once and then 'c' once and then 'd'. [00:11:40](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m40s) Provision has been made up to z z. That is the quantity of tables there may be in this area'AS'. Then first decide what type of return this 'Return Row Type' have to be. +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'. - If it is set to multiple, these names automatically update. [00:12:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m02s) The way that the get method will work, is it will create a new method which will get this data and add 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 which is 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) +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 it is not possible, a sermon can only be connected to one series. That means 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) +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 some further development needs to be done in this area.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<