 Hello everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So today we are having day 12 of APN Bootcamp. And I have Ankit with me. Welcome Ankit on the platform. So Ankit delivered 11 sessions and today you will be understanding some more concepts related to APN in day 12. So Bootcamp is going good and lots of folks are getting benefited with this. So I am happy like our efforts are going in the right direction. And if you are struggling with the instance, if you want to do proper practice of APN. So just ping in the telegram group which we have created so that Ankit and team can help you out. So like having instances is very much important so that you can do a proper practice. Okay, so and if you want to receive timely notifications, so just follow Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram and Telegram. And session tracker link is available in the video's description. Okay, so with this I hand over to Ankit. Ankit please give some more insight about today's topic. Sure. So if you want to check all the recorded sessions so you can check it on our YouTube channel that is the CodeMetro. And there is other contents as well related to APN so you can go through and learn from that as well. If you have any query or any questions you can put on the CodeMetro Telegram group where there are some members. And if you are not part of that group so you can join that group. In our last three sessions we are learning about APN interfaces so this is also the extension of that APN interfaces and expression rule. Okay, so know that we already learn about the expression rule. Okay, so there is one term or there is one component that we call as query entity. Okay, so what is query entity? So like you know that in our general case like whenever I want to fetch some data from database I write select query, right? Like select a star from take one name where the conditions are in this particular. Okay, so in for the same query SQL query we use query entity in APN. Okay, that to get the data from database and we write this is also an expression rule. Okay, so we write an expression to execute that query. Okay, so I can show you how we can create. Okay, so like you know that in our last sessions we learn about data store entity right in data store entity data store and then CDT that is custom data type. Okay, and data store entity is the correct know is the link between database table and APN and CDT or the custom data type represent its structure. Right, so with the help of the data store entity we create that query entity. Okay, to get the data from that particular table. So how we write I can show you. Okay, so it's an expression rule as we are told. So I will create an expression rule and this is pre-critical and fetching the data from the particular table. Okay, so I will I can write you know that we have a CDT here and from that we will get the data that is AB employee details. Okay, so I will get the data from this table. So I will write like that data from employee details. Okay, so this is express description of that expression that is a query entity and we save into a rule folder because expression rule is a rule right. So we save expression rule interfaces constants in rule type of folder. So I will select AB rules and constants. Okay, so now you can see the expression editor. Okay, so in expression editor we have three parts. One is for rule input that is the right part middle part is for testing like I do testing on test cases and left side is for writing the expression. Okay, so if I want to run to get get the data from table and I want to write query entity. So if you have one function that is a query entity. Okay, so this is the function. And now you can see it has three parameters right entity query and fetch total count. So I will write first parameter that is entity entity is nothing but data store entity that you can see here in the description. Okay, so for the CDT we have one data store entity right. So this is the CDT and we created one data store entity for this particular CDT right. So this is data store entity and so we will use this data store entity in this parameter. Okay, but we do not directly use this data store entity but we use the constant of this data store entity. Okay, so first what we will do we will create a constant for this particular data store entity. So how we'll create constant AB generally we will give this prefix here or the name sort form that is data store entity and it's a constant so everything will come in caps. In description I can have contents yes. And as it is a data store entity so its type will be data store entity okay that you can see here. Okay, and what data store will be AB data store. And second I can check the data store name that is let me check the name of the data store that you can check from here. It's AB employee application okay. So I will select AB and call application. And now from this dropdown we can select entity okay that is the data store entity and I will select this one AB and call details. And now I'm clicking on correct. Okay, so now you can see we have constant of data store entity type. So this constant we will use in this query entity okay in the entity parameter and constant we use with C, O, N, S, bang and then name of the constant okay. What is the name of constant AB and that's for DSE, Emperor details right. Now the second parameter is query okay. So this is something like table name right if we can see no compare with database query okay. So in query what we use query the query to execute right. And we create this using a query function so we will use a query function. So in a query also we have some parameters like selection aggregation logical expression filter paging info. So same like that right if you want to select some but fills from a table. So like there is a table and the table have five fills ID name a salary okay and I want only one column that is employee name. So I write the query something like select employee name from this table okay. Same like in query entity we use select sample okay. And if you do if you want to fetch all of the column from a database table then we use select star right. So in this one also I do not need to give the selection if I want all of the columns from the table. If I want some particular column then only I have to use this. Selection and in selection you can see here this is array type. Now fills to be treated with a query entity a query selection okay. So I will use this way this function here and what all parameters this function have columns right. And this is multiple type right columns. So this is array type of a parameter so we will use curly braces right. And in this one we will use this function a query column okay. You do not need to know remember everything. You have you can just go to the description of the function and you can check all the parameters okay. Like this first parameter is filled so what so like if we take the example of this CDT. So this CDT have three fills employee ID company ID employee name okay. If I want employee name then I will use employee name here okay. If I want to alias so I will use this one. If I do not if I want to you know make it is visible or not in that case I will use this okay. Suppose I want one more fill then I can copy this one and I can give other name like company ID. Now the third parameter of this a query entity is first total count right. That we will learn later but in a query also first parameter is selection then. Second parameter is aggregation logical expression filter and paging okay. So I will use paging info now paging info what we use you can go here and you can check. Okay they paging and sorting configurations to apply when retrieving the data okay. So suppose if I want to fetch some number of rows like five rows ten rows okay. Then I then I give it you know particular like there are some parameters that I configure. And if I we want to sort the data on basis of particular fields then also we use the paging okay. And it's a required bit okay you cannot make it blank. And this one function that a paging info that we use okay to define the paging info. And here you can see we have three parameters start index bet size and so on. Start index bet size and so okay. So start index suppose one start index index means like from this line I have to fetch the data from database table. Okay and bet size like how many rows I want to fetch. So if I want to fetch all of the rows then I will use minus one okay minus one. And if I want to fetch particular number of rows like five rows ten rows then I will give the particular best size. So like suppose I want to fetch all of the rows from the table I will use minus okay. And sort and if I want to sort the data for you know for a particular field so I will use this a sort info. And in this one I can configure field is again it will be a CDT field okay. So whatever name in CDT I will use. Suppose I want to pair sort on basis of employee ID like this and then if I want to use that ascending to your force that also I can configure. So like if I want to use ascending to then I can give if I want to pair sort on basis of ascending force then I can give force. So these are required selection is not required but paging info is a required parameter that we have to fit an entity is also required. So now if I test the rule so now you can see it is returning the data from the database table okay. So and first it is returning the data subset that we start index is one besides minus one that we configure and we sort this particular data on basis of employee ID and ascending was true. And how many rows are there nine rows are there right in the database table and this is the data. So in data you can see employee name and case company ID one because we configured only two fields in selection that's why it is returning two. If I do want all of the fields I can simply comment this okay. And now if I again test it will return me the whole three fields okay employee name company ID employee ID. So if I want all of the fields from a particular table okay I can skip the selection parameter okay. And if I want to fetch some fields only from the table I will use the selection. So like this we give the selection and paging info I want three rows only so I will give three and I can again test. And now you can see it is returning only three rows okay three items. Now if I want to filter out the data right this is we are fetching here all of the rows from the table right. If I want to filter out the data on basis of you know fields so I can use other parameter. So there you can see we have filter and logical expression so I can use filter parameter if I want to filter out the data. So in this one you can see we have a single condition so suppose if I want to fetch you know filter out with single condition then I use filter. And in this one to apply the filter we use a query filter function okay. Now you can see here we have these parameters filled so again the field will come from CTD. So suppose I want to filter out on basis of company ID. I will use company ID here operator okay. So you can apply any of the operator from this list like equals to not equals to greater than greater than equals to less than and other okay. So if I suppose I want to use equals to I will use equals to between double course as we discussed like in APN everything that is in text come between double course value. Suppose I want to fetch you know that data from this database table where company ID is 2 or 3 okay. Suppose I want to fetch the data where ID is 3 so I will give the value as 3 and now you can see clicking on tool and it is returning only one row where the company ID is 3. Suppose I want to fetch the data where company ID is 1 then it is returning the row where company ID is 4 okay. Those are like these are 4 rows where company ID is 1 1 1 1 that you can see here okay. Like this we apply the filter if I want to apply not equals to then I just put this one and it will fetch the data where ID not equals to company ID not equals to 1 okay. So here you can see we do not have any data with company ID 1. Suppose I want to apply multiple filters okay instead of single filter in that case we use logical expressions okay so that is also a parameter here. So we use logical expression and inside this logical expression we use a query logical expression right. And here you can see the parameters operators logical expressions like if I want to use nested logical expression I can use logical expression inside the query logical expression as well. Filters and ignore filters with empty by which so suppose I want to apply the condition like where name like country equals to India and state equals to Rajasthan okay. So in that case I will use operator and right but if I want to fair the data like something like where country equals to India or country equals to Europe okay UK. So in that case I will use operator or filters are multiple then I so I can use curly braces okay and we I will use the same function that we used for filter. That is the query filter in this one also I will use field like field I am using company ID operator like equals to and value like say one or I can use five okay and I will apply one more filter here. Employee need equals to Daniel so here you can see for company ID five we have multiple rows right this one this one both are for company ID five but for Daniel there is only one row okay so if I check this it will return only one value okay one row where the employee name is Daniel and company ID is five okay. So this condition is in and if I put over here so it will fair the data where employee ID is sorry employee name is Daniel or company ID equals to five. So it is returning more value right like this it check the condition in or one or and so like this we use logical expression okay and if I want aggregations same like in database we will like group by count or know the other logical expressions so I can use aggregation. So same like database we can use aggregation here as well okay so in aggregation I can configure the parameters like there is a function a query aggregation. And we do not use aggregation and selection all together okay we are using aggregation we want to use selection same like database. If I am using aggregation I have to select same and in this one I can configure the aggregation columns okay and this is array so I will use curly places. And in this one you have a function that is a query aggregation column and in this one I can define the parameter like field on which field I want to apply the aggregation okay if this field you know I am using this field for grouping then I use is grouping. If I am applying some aggregation functions on this one so I will use aggregation functions right like aggregation functions are like you know that you can see here we have like count okay so all the aggregation functions we can apply here. So this is all about very entity if I want to pass the dynamic values I can apply here okay so suppose now you can see here I applied the hard coded value five okay for company ID. But suppose if I want to apply the dynamic value here that I know want to pass from its parent then I can simply queue here like I can create a variable goal input. And I can give it any name but it's the best practice to use the same name that we are having in CDT. And it's integer type so I will use here integer and okay and I will I can replace this with IRI okay that is a doing too. And suppose if I want to pass here I want to check for ID five I can simply click on. Okay and it is what it is showing it must not be null or empty okay so in this one it is giving the error because of this because we did not give any parameter here. If I apply here so you can see here okay this RI is applied and its RI value is five in this case but if I want to update I can update with one. And it will give the value for company ID one and employee name Daniel same like I can make it this one also dynamic by creating the rule input. Okay so like this we use the query entity first no we create the query entity with by using the multiple functions in nested format and then we can get the data from database table we can apply the filters we can apply selection we can apply paging input okay. In some cases if I do not want to fetch the data you know data subset or the total count I can simply use this parameter as false. So I can configure this parameter as false and it won't return the total count and all. So now okay so if I configure this in false it won't return okay so like this we use like if I want to display some data into our interface. Okay that is stored in database so we use query entity in interface. Okay so like suppose I'm saving this data this expression to query entity and if I want to fetch this in this channel in this particular interface. I can simply create a local variable that we already discussed like a local variable. So this is a block type of function and in this one I can create one local local employee details I can see and if I want to fetch. The data from query entity I can simply pass you call this with the prefix rule and then I would give this name. This expression rule of the query entity have some parameters that's why it is giving the error so I have to pass the parameter company ID. So suppose I want to pass company ID like for okay I can simply give this one and if now if I test this one. So you can see here we have the value in this local okay that query entity is returning to us. So here you can see the values okay so like this we can use the query entity in expression rule or interface. Now suppose I want to display the information that is in query entity in a particular field. So I can use the similar thing here like this a text field label I can give employee name. Suppose I want to show the employee name from this query entity or the table in value I will use local because the details are in local. Local employee details and what was the field name in CDP employee name right. So I will use employee name and you can see the output of this query entity was not data but data subset right. So inside the data subset we have data so I will use dot data dot employee name okay. So you can see here we have Daniel okay in this text field and that was the output of this particular local that you can see from here employee name is Daniel. If I want to display company ID okay I can simply use company ID here and this name must be same as CDP okay and this is case density also. Okay so company ID must be same as this field must be same as CDP field okay. So now you can see here we have five if I want to make it as read only so that user want to be able to change I can read only. So now you can see five is coming here but user want to be able to update okay. So like this we use query entity in that interface or expression rule and in the interface we can display the data that we are fetching from query entity to interface component. So in interface we learn about you know that some of the components in our last session. So now there are two type of grid that we can create in APN one is read only grid and other is editable grid. Read only grid where we can display the data to user but user want to be able to update this okay. So for that we create the read only grid but if you want to allow user to update the details we will use editable grid okay. So if I want to create a read only grid like suppose I want to create a read only grid I can simply go here and can search read only grid okay. And I have to just drag it and now I can configure the parameters okay. So in read only grid we display the data right. So to display the data we will be needed of the data source or the particular data. So the data source can be record can be vary or a variable rule or expression okay. So we can select any type of data source. So like this if I want to display the data in this read only grid I can use the query entity also because in query using query entity we are fetching the data from database table. And if I want to display the database tables data in this interface or in this read only grid I can simply call that data query entity. And I first I can store that query entity data in this particular local like we did before. So local employee data use this query entity name this one right. I can pass ID for this okay. I can close this local variable okay. And now I can update this label also. I can give the label sorry the data to local employee it is local employee data okay. Now there is an error like you know that if I am using the data subset from a query entity. So I cannot give minus one batch size into that query entity okay. I have to use some defined batch size like five or six. So suppose I am giving five. Now we have to configure the other parameters okay. So like in this one column so suppose if I want to display some columns in the paging grid sorry in the read only grid we use columns okay. So in this column you can see here we have some parameters like a grid column that I can use here. So suppose I want to use and in this one we have a label. Label I can say in value we can use multiple type of fields here where we can show the read only data or I can simply use that. So like in this one you can see we can use all of the read only type of field like if I want to display image I can use image field I found the display link field I can use that okay. So like this we can use and if I want to display the data from a particular row okay from that particular table I can use FP row and then the column name. So column name is like company ID I can simply give this one okay. Now there are other parameters like helpful type instruction that we can give same like other components data will already given page size we can give okay. If I want to display some number of rows paging save into we can give okay like paging save into we can use FP paging that is a function okay that we use to display okay. So like this we look in this one if I am using this one I can simply remove this parameter as well because it's it needed the total count okay from this particular CDT okay. Now there are some other areas that you can solve by using the other parameters okay like total count value other than minus one okay. So that we can configure by using this one okay. So like this we can use here okay and we can configure them read only grid okay similarly so there are other parameters also that you can configure and you can check like if I want to use this particular grid as selectable grid okay. I want to select some number of rows so I can configure this selected parameters selection type okay and selection values and all if I want to give other you know like in a border style and other than we can configure this type of parameters. So this all parameters we can configure and we can create the read only grid okay. So you can practice on that that we know other parameters details are also in the tape in documentation okay so you can learn if you can read from there that I already pasted in our telegram channel group. So you can go through come there and if you have any question you can ask on that one okay. Similarly we can create the editable grid also okay like if I want to create editable grid editable grid in the grid where user can update the data right. So we can create editable grid okay so for that also we can write the component similar to read only grid okay. So here you can see we can configure the fields from here okay directly or we can configure from the expression mode. So in this one you can see here we have this label that we can change we have label position that we can change header cells are like the columns number of fields or number of you know that columns that you want to display here in this grid okay. So suppose if I want five columns I will use this five times with different different labels okay. So if I want to configure the you know change the configuration of columns and I use column configurations like the size of the column and all. Rows like we define the rows in this one so we define the fields okay for each row like suppose there are five rows so we define that one and this is this can be dynamic right. Right the number of can be as the tables results so suppose there are five rows in the database table then there will be five row if suppose I want user to add new row okay then also it can be dynamic right. So for that because it's dynamic and it can be multiple so for to create this we use A4 each help because A4 is a looping function right in APN so we will use that okay to create the rows. Similarly we can have other you know parameters also same like read only grid like select table and all. If you want to allow user to create a new row in this particular editable grid we use add row link here okay so it will display the link to the user and user can add new row okay and can fill the details in that one. So like this we use the editable grid okay so this was all about interfaces okay. I explained some of the interface components and layouts okay for more practice and details you can go through that APN documentation that I shared in your telegram group okay so you can check from there and if you have any query because if you do the practice then you will know about the other parameters as well. We use mostly these parameters only so but in some cases we will be needed of other parameters also so you can read about other parameters if you can do the practice from that APN documentation and from this you know our recording of the video. So first go through this one and if you all you know you are read go through this video and know that practice on that one like from the last three to four sessions that we learn about interfaces okay and about expressions rules so I have shared the expressions rule you know functions and interface components so you can go through that. And if you want you know that community account access so you can simply request on this Google form or in our telegram group. If you have any other query then also you can ask on our telegram group or you can post that on our training at the code maestro.com Gmail okay so and we will put you know that whatever query you have we will give the answer and we will give the response on that. So thanks for today I want to hand over to Sandesh sir. Yeah thank you Ankit for the insight insightful session today and guys please share a review or feedback about the bootcamp and for instance as Ankit already shared the information please share your request in the telegram group so that we can help you out. Next session we will be having next week so till then practice whatever is being delivered so far. Okay I think this is it for today. Thank you Ankit for sharing the knowledge with the community.