Updated 013 dynamicGet (markdown)
parent
8d19a4cbf4
commit
a641253f2f
@ -27,21 +27,28 @@ If the main purpose of the view is to show a list of preachers, then 'getlistque
|
||||
|
||||
### 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(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.
|
||||
|
||||
### 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)
|
||||
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.
|
||||
|
||||
### Join View Tables Example
|
||||
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)
|
||||
|
||||
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)
|
||||
The unwanted fields can be removed but the string should not be editted as some further development needs to be done in this area.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The joint view Table, let you again 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) Again you can select whether it should return a single row or a list of rows. When you say single row, it means it's going to join it to this other data set that you have as your main data or your main source. It will just be another item in the array. That's why you can't use the name 'Name' for example here. [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. So again if you select anything here(Scaling Factor - dropdown), Series, you will see that it will populate this(Selection) area with all the fields that is in that view. Then this 'AS' button here, [00:11:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m21s) you can't use the same alphabetic number 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) We'd made provision up to z z. That is how many tables you can have. Only in this area here(AS).
|
||||
|
||||
You would first decide whether this 'Return Row Type', what type of return it will be? If you set it 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's 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, I'm using the 'c.id'. 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 I wanted to return a multiple, it means that the main database which is in this case sermon, can be linked to multiple series's.
|
||||
|
||||
But in the system we are working with here, [00:12:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s) that is not possible you can only connect a sermon to one series. That means it's certainly a single return. Then it will immediately add this series_ in front of everything to insure it doesn't clash with your a table. That's what it's doing. Again you can remove the fields you don't want but please do not edit [00:13:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m18s) the string. It possibly would break. I want it to be possible that you can change this name to anything you like. We are going to try and do that eventually. You can be changing it will still write it this way in the code. That's part of why I'm saying you shouldn't change it not because it will break something, but because it will be ignored and you might expect something else than what it is actually doing. Still it is going to use this implementation, even if you change it. [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 I 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. That means [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) 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)
|
||||
|
||||
|
||||
I 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 will still write it this way in the code. That's part of why I'm saying you shouldn't change it not because it will break something, but because it will be ignored and you might expect something else than what it is actually doing. Still it is going to use this implementation, even if you change it. [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 I 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. That means [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) 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)
|
||||
|
||||
### Dynamic Get Preacher In Code
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user