- Home
- Salesforce Certifications
- CRT-450 Salesforce Certified Platform Developer I Dumps
Pass Salesforce CRT-450 Exam in First Attempt Guaranteed!
Get 100% Latest Exam Questions, Accurate & Verified Answers to Pass the Actual Exam!
30 Days Free Updates, Instant Download!
CRT-450 Premium Bundle
- Premium File 439 Questions & Answers. Last update: Dec 12, 2024
- Training Course 78 Video Lectures
Last Week Results!
Includes question types found on the actual exam such as drag and drop, simulation, type-in and fill-in-the-blank.
Based on real-life scenarios similar to those encountered in the exam, allowing you to learn by working with real equipment.
All Salesforce CRT-450 certification exam dumps, study guide, training courses are Prepared by industry experts. PrepAway's ETE files povide the CRT-450 Salesforce Certified Platform Developer I practice test questions and answers & exam dumps, study guide and training courses help you study and pass hassle-free!
Process Automation and Logic - 38%
9. 3.6- Apex Classes and Interfaces - Part 2A - Virtual and Abstract Classes
This is part two of this lecture. Let's continue click on from stopped. stopped. Until now, we hasten the indexes index modifier class. e class. We have created in Salesforcelesf we have instant. acted i.e. have created objects out class. s class. We have shown you how to create variable methods inethodsin a class and how to use them continuing withering with the rest steps keywords of bui class. a class. Let' Salesforce, enforce and show you show you what I did offline. till now.
Returning to Salesforce, we can see that we have the same class Pen, led Pen, with variables and a variable. We have a function Object() [in native code] that takes no arguments and only increases the static variable Pen count by one. I have also created a constructor. The structure Object() [native code] will take these three arguments and use them to create an instant object. So I can specify the pen's color, color, and price. So, in this case, the new object has what I enter when I construct the object. It will also make the Pen cone steeper. I have the pen count NUM method. I've also included the pen information method. method.
This is only to show the variables. riables. Then there are my writing methods. So allow me to go back a few slides. Now we're talking about what I can do in class. And we'll talk about the virtual class, the abstract class, extending a class, and overriding a method in a class. a cl Finally, we'll discuss the implemeninterface. I've divided the various tools we can use when developing an application into sections to help us understand them better. The first section will cover the class, how to extend it, and how to override methods. Part two will focus on the a-class. Part three will cover the interface and how to put it in place. Finally, we have security, both with and without sharing. This part will have its own lecture section. section. So, let's start with the class and then learn how to implement and override methods.
First of all, what's the virtual password? sed for? The virtual inward on the class enables the class to be extended. So this is the same ancestor. This example. example. I have the same class, which is iPAN. And simply by inserting the keyword "virtual" before the word "class," I will assign class to be inherited by class. This keyword can also be used to describe a method. So, if I use this keyword on the method, it will allow or allow this method in the d class to be overridden. So, for example, "Two" is the name of my method. I simply added the virtual keyword void to allow this method to be overridden by the class that will inherit it. Do you know how to inhextend a class from another class? r clasthat, we use the keyword "extends." The extends keyword is used to inherit the base class from class. An extended class inherits all of anothe's metaproperties. As a result, whenever I inherit a class from class r, I will inherit all of its default methods. The extending class has the ability to have more method declarations than the original eclass. As a result, I can add as many methods as I want to the one method inherited from tclass. A class can only extend within itself.
It cannot be extended any further. an that. This example. example. This is another class pencil. Pencil. And you'll notice that I have the class name after the class name extends and ends. I'm incorporating methods from the pen class into the clss. Finally, we have the okeyword. keyword. Overriding a method allows for a different method implementation. By using the keyword and the definition, the extending class can override the existing virtual method. You can use override to override metaclasses that have been defined as virabstract. So, if a class is virtual and one of its methods is also virtual, I can say that this method is method and the class that has extended tclass is virtual.
So, if I have classes A and B, where A is the parent class and B is the class that inherited class A, I must first copy all of class A's methods that are marked with the keyword "virtual." Doing that is polymorphism. orphism polymorphism? orphism? Polymorphism is essentially the same method in two different classes. However, the method will differ depending on the object being addressed. So, for example, First and foremost, there is the SS band on top. We added the keyword "virtual" to make it "virtual." Then we added the keyword "virtual" before the void to make one of its methods virtual as well. he void. Then, scroll down to the extending xclass,ng class, Pencil. Pencil. Pencil is a class that extends other classes by utilising the keyword, keyword, and their methods. smethooverridesoverrides one of the pen class's methods, which is the two method.
Let me now create a new object to instantiate the pencil class. Let me use one of the methods of the pen class so we have the right one. So allow me to type it and see what happens. Take note of the fact that this is called from the pen object. Why? Because the pencil is just inheriting the methods of the pen object. Now let's go back to the pencil, and let's override the virtual method. So in this case, we'll use this. So let me copy it to save some time, and let me paste it here. So this will not be a virtual method. As a result, I'll use the keyword override and keep the same name. And then I will just change this. So this is right. CTRL F to save the method code from a pencil object. And then let me call this CTRL E, and I will copy this and I will paste it, and this will be right too. So what will happen? Now? Notice that the first method is called from the Pencil object and the second from the Pencil object. Why? Because this second method, this method here, has been overridden in the pencil class. Now let me return to this guy and change the right two methods to get rid of its body. So this is an example of an abstract method.
Notice that if I change this, I will now have this automatic error. So I need to change the definition of my class and make it an abstract class. So now if I click on Save, this error will go away because I declared this class as an abstract class. Now, what would happen to this guy? This is a pencil class, and it extends the Pen class. And it has a right to method that overrides the Pen class's write to method. Now, this will work. So, why will it work if I go to execute anonymous? Because the abstract method is the right method, and this is also implemented here. So what happens if I remove this and then click on Save or Control US? I will have an error. Why? Because this class must implement the abstract method that is on the main class, which is the Pin class, So, if I go to the Pen class, I can see that I have an abstract method, and this method must be implemented here. So allow me to go to control G Undo and save this.
So now I have a parent abstract will have because it has at least one abstract method. And because this abstract method exists, the extending class must override it. What happens if I try to create an object of the Pen class? So pen. My pen is the same as a new pen. What will happen? Now? I will have an error. Why? because I cannot create objects out of an abstract class. Because this is an abstract class, it cannot be constructed. So I hope that you understand the difference between virtual and abstract. It almost certainly has some that can be overridden. It is virtual, which means it can be inherited or extended. But being abstract means that it must be inherited. It must be extended to be able to be instantiated. And an abstract class has at least one abstract method.
10. 3.6- Apex Classes and Interfaces - Part 2B – Interfaces
And finally, we talk about the third part, which is the interface and the implements keyword. What is an interface? An interface is just like a class, but it has none of its methods implemented. So it just has a list of methods. But none of these methods are implemented. So they don't even have a body. They are just empty, just like an abstract method. I only have the signature of the method, and I don't have anything in the body. A method defined within an interface has no access modifiers and contains just its signature. They don't even have any access modifiers. I cannot specify if they are public or private. They don't accept any access modifiers. Why are we doing this? We use this because it guarantees that a class has a particular method.
So if I need to force a class to use some methods, I use the interface. So implementing an interface means that I must implement each of its methods. This is an example. We have an interface called Purchase Order, and then it has one method called Discount. Notice that it does not have any access modifiers, and it does not have curly brackets. To implement the interface, use the keyword implements. To use an interface, another class must implement it by providing a body. So, as we have seen, the interface has a list of methods that don't have anything in the body. And to be able to use these methods, another class should implement this interface, and the class must provide a definition for each and every one of the methods of the interface. Notice here that a class can implement more than one interface at a time. But this is very important. But a class can only inherit or extend one other class.
So there is a difference between implementing an interface and extending a class, be it virtual or abstract. I can only extend one virtual class or one abstract class, but I can implement more than one interface at a time in one class. There is no need to extend here; there is nothing called a virtual or abstract class. It's not even a class; it's an interface. So this is an example. On top, we have the interface called Purchase Order. It has one method known as discount. And then we have two classes that implement the purchase order interface. Notice that we have the same method, and this method is implemented differently in each one of these classes. On the B2 BPO class, we have the discount method that returns a double of zero one. But on the B-2 CPO class, we have the same method, but the return is 0.05.
So this is the main difference. We have the same method, but this method is being implemented differently in two different classes. Let's jump to Salesforce and let me show you the interface. So what will happen now? Let me close this, let me close the debug log, and let me create a new interface. Let's make a new class to handle that file. There is no new interface; we'll just use this, and then we'll put the name OK on it and just change this to Interface. So now I'll use two methods in this interface. The first method is the discount method, which returns a double. And then we'll have a method that does not return anything, which is called announced. So this is it; let me click on Save. And now let me create two classes that will implement this interface. So the first one will be called Business-to-Business PO.
And because this class will implement the Interface Purchase order, it must define any method here. So I have two methods. Let me copy them. Control V. So the first one will have a body, and the second one will also have a body. So for the first one, let me say that it will return 0.1. And this guy now lets me add the access modifiers to the method. So let me call the public and this guy also. So notice one: I don't have any errors. I have implemented this interface in this class, and then I have defined the two methods.
And now let me do the same for the other class. So create a new Apex class. It will be business-to-consumer. So the discount in this case will be less. And I will also change the second method, which is the announcement and Control S.
Now let me open the Execute anonymous window and let me create objects of types B-2B and B-2C. And let's call some of the methods Let me also do the same for the letters B and C. So I will copy this line, and I will change B to C. Now I'll call the announce method once from B to B and once from B to let us run these four lines of code and see what happens. Notice one method is being called from the B2B class and the other from the B2C class. So going back to the class, I have two classes. These classes implement the Interface Purchase order, which means I must provide the code for them.
I did that; I provided the code for these two classes, as well as the B2B and B2C classes. And now calling these from different objects will yield different results. So if I call this from AB to B, this will be called. But if I call it from an A-B-C object, this will be called. So, going back to the slides: So this is it. This is a very important chapter. You need to understand exactly what the difference is between a virtual and an abstract interface. So let's conclude. A virtual class can be extended. So it has the option of being extended or not. It does not contain any abstract methods. It will be an abstract class if it contains any abstract methods. Its methods can be used in the class that extends it.
So the extending class will inherit all the methods of the main class. And finally, the virtual methods of a virtual class can be overridden on the child class. Then we have the abstract class. An abstract class must be extended.
You cannot create objects from an abstract class. It should be extended. And then the extending class can create objects. An abstract class contains at least one abstract method. What is an abstract method? It's a method that no one knows about. So it's just the name of a method. Its methods can also be used in the class that extends it. So if I extend an abstract class, I will inherit all of the methods of the abstract class. Notice that an abstract class can also have normal methods, so they don't need to be all abstract methods. Virtual methods can also be overridden. So this is the same as a virtual class.
And finally, each and every one of the abstract methods must be overridden in the class that extends an app site class. And finally, we have the interface. An interface does not get extended, but it gets implemented. So there's a different keyword here: implements and extends. An interface contains only method signatures. It does not contain any code in S methods; it only contains the names of the methods. And finally, each one of these methods must be defined, not overridden. So we don't override here, and we don't extend.
We implement and define the methods. So this is the difference between abstract and interface. So to make it clear one last time, a class can be virtual, which means it can be extended. Optionally, if it contains at least one abstract method, it will become an abstract class. An abstract method is one that does not have anything on its body. And finally, we have the interface. The interface is just like a class, but it's not a class. It only contains methods and nothing about the body.
And you need to implement an interface to be able to use it. And finally, as a summary, this was a very long chapter but a very important one. It's the basis of your Apex understanding. And in the first part, we talked about object-oriented programming concepts and the difference between procedural programming and object-oriented programming. And then we talked about the difference between a class and an object.
We have talked about static methods and static variables. We have talked about constructors. We also talked about access modifiers: public, private, and global. And in part two, we talked about the other keywords that we can use in constructing a class: virtual extent and override. The abstract extent and override And finally, we have talked about the interface.
What does an interface mean, and what's the meaning of implementing an interface? And there's still one thing that we need to talk about in constructing a class, which is the security of the class. We'll discuss both sharing and not sharing keywords. So this will have its own lecture in this section. And finally, as usual, thanks for watching.
11. 3.7- SOQL, SOSL and DML - Part 1A - SOQL Syntax and Where Clause
This lecture will be divided into more than one part. We'll start with the first part. Sokquery, first of all, stands for Salesforce Object Query Language. Let's dissect this. S stands for Salesforce. So this is a Salesforce language, or "stands for object." This language acts on objects, be they standard or custom objects. Q stands for query. This is a query language.
And finally, L stands for language. This is a language that has its own syntax and its own rules. Just like SQL, SoCal uses the select statement combined with from and where to return some data. SoCal, unlike SQL, does not have a select statement. Why? because Salesforce is a multitenant environment. You primarily share one instance with a number of other organizations. So selecting Star will return all the fields of an object, and using it will slow down the system. So this is why it's not available in Salesforce. Now, Salesforce has no equivalent insert, update, or delete statements like SQL. SQL has these, but they are not available in SQL. We'll see how we can overcome this.
These are available in DML. We see DML in a later part of this lecture. Just like Apex, case-insensitive and SOQL can be used within your Apex code. So in Apex and my Apex code, I can invoke Sockwell. Let's talk about the Sockwell syntax. To build a Soqwell query, we start by selecting a keyword, followed by one or more fields. And then we type the from key followed by one object name. And optionally, we type the keyword followed by one or more filters. And after that, we have many other optional keywords that we'll see on the later slides. The field names are the API names of the fields, not the label names. The fields mentioned should exist on the mentioned object. So if, let's say, I have an account object, the fields after the select keyword should be from the account object. And finally, the order of the fees after selection will dictate the order of the results. So, this is an example. I have selected the ID and name from the object account. In addition, I have a filter called "Name equals Union Bank." So, what will this query return?
This square will return all the records, ID, and name fields from the account object where the name of the record equals Union Bank. Now, how can we get the object field API name that we can use after the select keyword? We have many options. First of all, we have a document called "Object Reference for Salesforce.com." This is a document that we can find in the Salesforce developer documentation. Let me go to this document and let me show you where we can find the field's API name. So, this is the document. We go to the reference section, and then we can select any object. So let's select the account object, and then we can find the API names of the fields of this object. Another place where we can find the API names is the developer console. We'll see that in detail in the demo. We can go to the Developer Console file and choose the object that we want. We can also check the API names, the workbench, and the setup menu.
We can go to the Setup menu, we can go to the object in question, and we can see the field labels and the field API names. And finally, we can get some Chrome extensions that will show me the API name instead of the label name of a field. Now, we can write soccer queries in many places in Salesforce. First of all, in the data loader, whenever you choose fields to export, you are in fact building a so-called query. and you can see this query at the bottom. We'll see that in detail. We can use soccer and the developer console. There is a place where we can invoke SOQL queries and the Developer Console. So the Developer Console can be our one-stop cloud-based tool that we can use to write Apex and invoke so-called queries. And finally, we can invoke so-called queries and the workbench. As I have mentioned, this is a cloud-based application that connects to our Salesforce.org.
The most important place where we can write "queries" is within our Apex code. The real power of Sock will come when we combine it with Apex. So let me give you an example. In previous sections, we have talked about workflow rules and process builders. And we have seen that these have some limitations. These limitations are not present when using SoCal in Apex. In fact, when using SoCal within our Apex code, we can fetch records from any object in our Salesforce.org. We are not limited to some objects. We can fetch data from absolutely any object that exists in our Salesforce.org. This includes any unrelated records. And it does not only include standard or custom object records; it also includes other settings like the all-level settings, the currency conversion, and the sharing permission. I can do all of that within my Apex code using Sockwall. So I'm not only limited to object records.
Now, when can I submit soccer queries? I write Sockwell queries when I want to retrieve data from an object in My.org. And I can also write so-called SQL queries when I want to count the records that meet a specific criteria. Until now, we have seen the syntax of a so-called query that selects some fields from an object. But what if we want to filter our results? We use the clothes to accomplish this. The where clause is optional and is used to filter the Soqwell query. You can specify the filter expressions after the keyword and the SOQL query. Furthermore, the filter expressions employ comparison operators such as equal, not equal, less than, equal greater than, greaterthan, or equal like N and not n.
They can also be used to compare strings and give you an example. We have a query, and the results show an amount greater than $150,000. So in this case, this query will return to me all the records of the opportunity object that have an amount greater than one hundred fifty, and it will only return the field ID at name. So in this case, I'm using the comparison operator greater than to compare a field with a value. This is another example. I'm comparing a field called type, and this query will return to me all the records that have type equals banking, so you can see that I can also use the comparison operators on strings. What if I want to compare a string field with a partial tax string? So let's say I want to have all the records where the name starts with A. So in this case, I cannot use equal or less than. In that case, I will use the comparison operator like.
Like provides a mechanism for matching partial textstrings, and it includes support for wildcards. Percentage and underscore are wildcards. The percentage will match zero or more characters, and the underscore will exactly match one character. The expression will be true if the value and the specified field name match the characters of the text string and the specified value. The text string must be enclosed in single quotes, so this will be taken as any regular string. The like operator is only supported for stringfields, and finally, the like operator will perform case-insensitive matching, so this is not like SQL, which is case-sensitive. This is an example. I have names like Percentage.
This so-called query will return tome opportunity records where the name contains iPad. It can have zero or more characters before the string iPad, and it can also have zero or more characters after the string iPad. This is another example. I have names like "bank" and "percentage." As a result, this query returns a meany account record that begins with bank, and the so-called many characters are resolved. So let's say, for example, that a single code character is reserved because it is used to specify a string. The backslash character is also reserved. The percentage and the underscore characters are used as wild cards. But what if I want to compare a string field with a string that contains these characters?
To solve this, the reserve character must be preceded by the backslash character. The backslash character is called the escape character, and it is used to sign that after me there is a reserve character that should be used as a character in the string. So let's say we have John's Bank after the n. I have a single quote to search for John's Bank within SoCal. I use the escape character before the single quote before the S. Now let's talk about n and not n. N is used to indicate if the value equals any of the specified values between the parentheses after the n, and not n to indicate the opposite. The values for n or not and must be in parentheses, and the strings must be in a single quote. And finally, N and not N can also be used for semijoins and anti joins. We'll see that in detail later on. Let me give you an example.
My billing states appear to be California, Connecticut, and New York. In this case, the query will return all account records where the billing state is California or New York. So in this case, I don't need to repeat this twice. It is unnecessary for me to state that billing state equals California or billing state equals New York. I can specify these using the n comparison operator. This is another use of null n. So this is the reverse of n. You can also search for null values in some fields by using the keyword null. We use null to represent null values or fields without any values and circle queries. This is an example. We have an activity date that is not equal to null. So in this case, this query will return to me the event records that have an activity date that is not null. You can also use the Boolean values True and False, and your so-called queries will be closed to filter against your Boolean fields. Let me give you an example.
I have here a query, and I am filtering against a Boolean field called "Active." And I can say that I want only the records that are active to be returned in the circle query. I can also filter by date and field date. So let's start by date. This is the format of a date filter. And this is an example. I have a field called CloseDate, which is a date field. I can use any comparison operator to compare this field against a date value. As you can see, I can also filter against date-time fields, but I must specify the correct value format. So in this case, this is the format of a date-time field. The created date is a date-time field. Finally, instead of providing an actual date or date time value, I can use a date reference. So in this case, Salesforce provides me with a list of date references. I can use them in my so-called query. Let me give you an example. I have rated dates equal this quarter. This quarter is a predefined reference that I can use instead of giving an actual date and time. Let me show you the list of references that you can use.
There is a document called Force.com, so reference and let me go to the Date Reference section. So let me search for references. And this is the list of date references. They are called dates, literally. So I can use all of these references, and my SOQL query was closed again. This is the force.com SOKWL and SOSL reference document.
We can also use logical operators to get close to combining the expression. So in the end, we can combine more than one expression to get a more detailed filter. So in this case, we have names like John and a status of "open." As a result, the records returned by this query should have names that begin with "John" and be open. They should be treated the same. I can also use or So in this case, either one of the two expressions should be true.
So in this case, I have an example of "type equal banking" or "type equal telecom." So, in this case, this query will return all of the account records that have the type banking or telecom. And finally, I can also negate this. I can use the "not" expression. So, in this instance, I have a name other than bank. So in this case, this so-called query will return to me all the account records that don't start with bank.
12. 3.7- SOQL, SOSL and DML - Part 1B - SOQL Aggregate, Optional clauses and Return
Now that we have talked about the filter expressions that we can use in a where clause of a Soqwell query, we will talk about the different optional clauses that we can use after the where clause. First of all, we talk about the limit. The element is an optional closure that can be added to a soccer query to specify the maximum number of rows that are returned by the so-called query. So this is a mechanism that lets us control the number of records, or rows, that we want out of a so-called query. Let me give you an example. I have here a query, and at the end I have limits and then one. So this query is guaranteed to only output one record or one row. So in this case, I can control how many records come out of a soccer air query.
Now let's talk about the "order by" clause. Without using the order clause, there is no control over or guarantee of the order of results from a so-called query. So if we don't use the order by clause and run a so-called query, we don't have any control over the order of the records that the so-called query generates. To control this, we use the Orderby parameter, which controls the order of the query results based on a specified field. So we can mention that please order the output of this query based on that field. So in this case, the first result will be the first result from this field. Order by is added at the end of a Sowell query, and if records are null, you can use nulls to display the results first or last. Let me give you an example.
This is the syntax of the order by order by.Then we state the field name, and then we can optionally state ascending or descending, and after that we can optionally state nulls first or last. This is an example of a query that acts on the account object and on the name field, and then at the end we have "Order by name, descending nulls list." So this query will output the different records of the account object, and then the order will be based on the name. So let's say there's a name starting with A, followed by B, and then C. So the order will be descending based on that name, and if there is any record that has a name equal to all, it will be last. Another example: we have a query on the case object, and we are ordering by the account with that name. So in this case, you can see that I can also order by the parent object field. In the sequel, we'll get a closer look at the parent-child object relationship. But this is just an example to mention that I can also order by a parent object field. Now, let's talk about aliases.
Alias notation is used to give variable names to different components of your so-called query. It can be used on aggregate expressions and the selectclose or on different objects and the fromclosed and your so-called query. So to establish the alias, we first need to identify the object or the aggregate function. So, in this example, we have select count, my count on the first line. So we have identified that I need an alias on the aggregate function count, and the alias name will be my account. The form close is on the second line.
I identified the object contact, and its alias will be C, and then I did the same for the parent of contact, which is account in this case. And I gave it an A. So now, if I use A and the third line, which represents how close A is to contacting that account, I have that name. So, instead of contact, I use the name "A," where "A" stands for "C account" and "C" stands for "contact." So in this case, I can make my so-called query more readable, and I can also use these aliases and my apex code, as we'll see later on. Now let's talk about group by.Group by is an option clause after the where clause of a so-called query, and it is a way to group the return results by a field. It is useful when you only want to know the unique and distinct field values as opposed to all the field values. So this is the same as grouping by air report. Think of a report. If you have a report with, say, thousands of rows and you want to group these by a field that you choose, you can do that, and you can do the same with the soccer query.
The syntax is "grouped by" and then we specify the name of the field that we want our records to be grouped by. Also very important, group by can be used either without an aggregate function, so in this case we are only checking the distinct values of the group by field, or it can be used with an aggregate function. So in this case, we are determining how many fields are associated with another field. So the first example will only return to me the unique values of the field that I selected on the group by, and the second example will do the same, but on top of that, I can count how many records are associated with that field. When using a group by the fields, it is critical that the select close of a socket or query be either in the group by close or have an aggregate function. This is an example on the left.
I chose a lead source from Lead and organised it by lead. As you can see, the group by field is the lead source, which means that the select can only have this field or an aggregate function field. On the second example, I have the same example, but as you can see, I have also added account name aggregate functions. So in this case, I'm allowed to do that because in the select close I have the group by field and I have also added an aggregate function, which is fine. One last thing I can do is use group by on the parent object fields, so in this example I have a query on the opportunity object and I'm grouping by the account; the name field of account is the parent of opportunity, and name is a field of the account object. It's worth noting that I can only use the group by field or an aggregate function field in the select clause. We've been talking for so long about aggregate or aggregated functions, so what are these aggregate functions?
Allow us to roll up and summarise the data in a simple query, so instead of just specifying fields and the select clause of a so-called query, I specify an aggregate function. An aggregate function will show calculated results from the query itself. Aggregate functions are mainly used with a group by clause and a so-called query, but they can also be used without a group by clause. Aggregate functions that can be used are min, max, sum, and average, and this is the syntax, so in the select close we type min and then, between parentheses, the field name. So in this case, I'm calculating the minimum value of the specified field and the same for max, sum, and average. These are some examples. In the first example, I'm using the aggregate function to average the field amount. So this query will return to me the average amount of all the opportunities in the account at the time of the communication.
So I'm specifying a filter and the object opportunity, and the select close is only the average amount, so this will return to me the average of the records that will be returned. So in this case, the average of all the opportunities from the account's ads and communications so same In example number two, I'm using the same thing, but I'm adding a field. So it's not only the aggregate function; it's the aggregate function plus a field. So in this case, I will have two things returned: the average of the amount of the opportunities and the stage name; I also have a group by; and in the third example, I have the sum of the field amount and I also have the stage name, so it's the same example as the second one.
But in this case, I'm returning the sum instead of the average. So this so-called query will return to me the sum of all the opportunities, and they are grouped by stage. We also have these two aggregate functions: count and countless things. Let's start by the count. The count will return to me the number of records, or rows, that are returned by the so-called query matching the query criteria.
So if, let's say, a SOQL query returns five rows, the count will also return five. It's worth noting that if I'm using the count aggregate function, I can't use anything else and choose close of a query. Now Count can take an argument, which is the field name. If I'm using count with a field name, this means that the so-called query will return the number of rows that match the filtering conditions. However, this time the records or rows returned are only those where field name is present. The field name that is specified after Count is not null.
So this is very important. And this is the difference between counting without any arguments and counting with a field name argument. Note that I can include more than one count fieldname expression and a select clause in a so-called SQL query. This is not like the count without any field names. Also, we have an infinite number of lengths; an infinite number of things are the same as count, but it will return to me the unique record counts.
So instead of returning me records that are not unique, it will only return me records that are unique. I can also specify a field name after countdistance, and this will act the same as an account with a field name. These are some examples of the Count and Countdiscipline aggregate functions. In the first example, I'm using the Account aggregate function without any arguments, which means that I cannot have more than this and the selects close. I cannot have any other fields or any other aggregate functions. I can only have this account without any argument, and this query will return to me the number of records returned by the query. So it will give me the number of account records.
In the second example, I'm having two different aggregate functions, noting here that I can have more than one function because I'm not using the Count without any arguments. So this query will return the number of rows where ID and account ID are not null. And finally, I have the account's distinct example. This is the same as Account, but the difference is that it will return to me the number of distinct values. And in this case, I have a field as well. So it will be the number of distinct and non-distinct field values matching the so-called query. Now that you know more about SoCalled, its syntax, the select close, front close, and where close would specify the different filters, and the various optional keywords like order, by like limit, and so on, you may be wondering: how can you invoke SoCalled in Apex? Well, we can invoke "so called" in Apex by simply typing the "so called" query inside two brackets.
Let me give you an example. I have these Apex lines of code on the right side. I have a so-called query between two brackets, and this so-called query is assigned to a variable called opt. So this is simply how we can invoke Soquill in Apex by simply putting the so-called query between two brackets and assigning it to a variable. Let's look at the various variable datatypes that can be assigned to a "so-called query." First of all, a SOQL query can be assigned to a list of concrete objects that can be assigned to a list of accounts, opportunities, or custom objects. As you can see in the first example, we have a list of accounts called acclist. And this account is assigned the so-called query between the two brackets.
Similarly, we can assign a query to a custom object list. So in this case, a list of positions called a position list is assigned to the so-called query. This is the most common Socalled assignment. Another assignment is a single S object. This can also be done, but in this case we need to make sure that the so-called query returns only one record. If the so-called query returns more than one record, then you will get a query exception and the assignment will fail. As an example, we have the "s" object account, and we created a variable of this "s" object type, and then we assigned the "so-called" query to this variable. The same goes for any customer object. A so-called query can also be assigned to an integer in the case of using the Account aggregate function. So if I use the account without any field name arguments, I can assign this to an integer.
And finally, I can assign a so-called query to something called an aggregate result. Aggregate Result is used whenever the so-called query that I am assigning contains an aggregate function. an aggregate function like count, fill, name, count, distinct, sum, average, minimum, and maximum. This does not include the count without any fields because this is assigned to an integer. So, if I use any of these aggregate functions, I must assign the query to one of the aggregate result objects. So in the case of my sockwell returning just one record, I will assign this to a single aggregate result object. If my so-called query returns more than one record, I will assign this to a list of aggregate results. After assigning my so-called query to the aggregate resultor in the List of Aggregate Result, I can get the values back by fetching the aggregate resultor in the List of Aggregate Result. I can also use variables in my so-called query. To do that, I need to make sure that I precede the variable name with a column.
This is called variable binding in the apex. Let me give you an example. I have an integer called my Amand, and the value of this integer is 100,000. So instead of using 100,000 in my query, I use the variable that represents it, which is my AMM. So, as you can see in the way close of the so-called query, I have an amount greater than the number in my column, then I have my double amp, which is the integer 100,000 variable, so this is variable binding in Apex. This is an example of a query that employs an aggregate function, and the return type of such queries is known as aggregate result. It can be a single aggregate result if we are sure that the so-called query will return one record or a list of aggregate results if the so-called query will return more than one record. So in this case, the so-called query will only return one record because I'm specifying the account name to be a specific account.
So I will bind the soccer query to the aggregate result variable AW g, and then after that, I can dig inside this AW g to fetch the results of the aggregate function of the so-called query. This is another example, but in this example, I have a list of aggregate results instead of a single aggregate result. Why? because the so-called query might return more than one record. So in this case, I have selected the opposite amount from opportunity, where I account for that name like e. So any accounts that start with "Ewill" should be included in the so-called query. So we might have more than one record? You might have more than one average of the amount of the opportunities in each account, so in this case, the list of aggregate results will have different records, and each record will be for one account. Now to fetch the result. We can approach this in the same way that we would a map. As you can see in line three, we have an object Avg equal to an AW g of zero. A value of zero will represent the first record returned by the so-called query.
The average of this will then be returned to me by Avg. Why? Because I'm using Avg, which is an alias, and the select close command, this is another example. This is an example of group bar and aggregate functions, and at Apex I have a list of aggregate results. Why? I have a list of aggregate results because I have an aggregate function and so-called queries, and then I'm looping through the different elements of this list to find the results, so you can go through this code; I will include this code in my demo so you can check it out.
Salesforce CRT-450 practice test questions and answers, training course, study guide are uploaded in ETE Files format by real users. Study and Pass CRT-450 Salesforce Certified Platform Developer I certification exam dumps & practice test questions and answers are to help students.
Purchase CRT-450 Exam Training Products Individually
Why customers love us?
What do our customers say?
The resources provided for the Salesforce certification exam were exceptional. The exam dumps and video courses offered clear and concise explanations of each topic. I felt thoroughly prepared for the CRT-450 test and passed with ease.
Studying for the Salesforce certification exam was a breeze with the comprehensive materials from this site. The detailed study guides and accurate exam dumps helped me understand every concept. I aced the CRT-450 exam on my first try!
I was impressed with the quality of the CRT-450 preparation materials for the Salesforce certification exam. The video courses were engaging, and the study guides covered all the essential topics. These resources made a significant difference in my study routine and overall performance. I went into the exam feeling confident and well-prepared.
The CRT-450 materials for the Salesforce certification exam were invaluable. They provided detailed, concise explanations for each topic, helping me grasp the entire syllabus. After studying with these resources, I was able to tackle the final test questions confidently and successfully.
Thanks to the comprehensive study guides and video courses, I aced the CRT-450 exam. The exam dumps were spot on and helped me understand the types of questions to expect. The certification exam was much less intimidating thanks to their excellent prep materials. So, I highly recommend their services for anyone preparing for this certification exam.
Achieving my Salesforce certification was a seamless experience. The detailed study guide and practice questions ensured I was fully prepared for CRT-450. The customer support was responsive and helpful throughout my journey. Highly recommend their services for anyone preparing for their certification test.
I couldn't be happier with my certification results! The study materials were comprehensive and easy to understand, making my preparation for the CRT-450 stress-free. Using these resources, I was able to pass my exam on the first attempt. They are a must-have for anyone serious about advancing their career.
The practice exams were incredibly helpful in familiarizing me with the actual test format. I felt confident and well-prepared going into my CRT-450 certification exam. The support and guidance provided were top-notch. I couldn't have obtained my Salesforce certification without these amazing tools!
The materials provided for the CRT-450 were comprehensive and very well-structured. The practice tests were particularly useful in building my confidence and understanding the exam format. After using these materials, I felt well-prepared and was able to solve all the questions on the final test with ease. Passing the certification exam was a huge relief! I feel much more competent in my role. Thank you!
The certification prep was excellent. The content was up-to-date and aligned perfectly with the exam requirements. I appreciated the clear explanations and real-world examples that made complex topics easier to grasp. I passed CRT-450 successfully. It was a game-changer for my career in IT!