Use Groovy Expression in ADF

Advanced Oracle ADF 12c Course Model|Groovy Expression, Bind Variables and Overriding Methods
21 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.33
List Price:  €91.90
You save:  €27.57
£55.09
List Price:  £78.70
You save:  £23.61
CA$95.29
List Price:  CA$136.14
You save:  CA$40.84
A$104.44
List Price:  A$149.21
You save:  A$44.76
S$94.20
List Price:  S$134.58
You save:  S$40.38
HK$546.10
List Price:  HK$780.18
You save:  HK$234.07
CHF 63.62
List Price:  CHF 90.89
You save:  CHF 27.27
NOK kr751.73
List Price:  NOK kr1,073.95
You save:  NOK kr322.21
DKK kr480.45
List Price:  DKK kr686.39
You save:  DKK kr205.93
NZ$114.09
List Price:  NZ$162.99
You save:  NZ$48.90
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,195.22
List Price:  ৳11,707.96
You save:  ৳3,512.74
₹5,830.20
List Price:  ₹8,329.22
You save:  ₹2,499.01
RM328.07
List Price:  RM468.70
You save:  RM140.62
₦102,885.30
List Price:  ₦146,985.30
You save:  ₦44,100
₨19,393.48
List Price:  ₨27,706.17
You save:  ₨8,312.68
฿2,536.99
List Price:  ฿3,624.43
You save:  ฿1,087.43
₺2,256.71
List Price:  ₺3,224.01
You save:  ₺967.30
B$357.27
List Price:  B$510.40
You save:  B$153.13
R1,265.02
List Price:  R1,807.25
You save:  R542.23
Лв125.89
List Price:  Лв179.86
You save:  Лв53.96
₩94,793.75
List Price:  ₩135,425.45
You save:  ₩40,631.70
₪259.28
List Price:  ₪370.41
You save:  ₪111.13
₱4,039.50
List Price:  ₱5,770.97
You save:  ₱1,731.46
¥10,895.69
List Price:  ¥15,565.94
You save:  ¥4,670.25
MX$1,162.43
List Price:  MX$1,660.69
You save:  MX$498.25
QR253.91
List Price:  QR362.75
You save:  QR108.83
P948.27
List Price:  P1,354.73
You save:  P406.46
KSh9,168.69
List Price:  KSh13,098.69
You save:  KSh3,930
E£3,283.23
List Price:  E£4,690.53
You save:  E£1,407.30
ብር4,009.02
List Price:  ብር5,727.42
You save:  ብር1,718.40
Kz59,310.71
List Price:  Kz84,733.22
You save:  Kz25,422.51
CLP$62,605.89
List Price:  CLP$89,440.82
You save:  CLP$26,834.93
CN¥505.55
List Price:  CN¥722.24
You save:  CN¥216.69
RD$4,078.44
List Price:  RD$5,826.59
You save:  RD$1,748.15
DA9,404.82
List Price:  DA13,436.03
You save:  DA4,031.21
FJ$155.95
List Price:  FJ$222.79
You save:  FJ$66.84
Q543.74
List Price:  Q776.81
You save:  Q233.06
GY$14,641.89
List Price:  GY$20,917.88
You save:  GY$6,275.99
ISK kr9,678.91
List Price:  ISK kr13,827.61
You save:  ISK kr4,148.70
DH693.20
List Price:  DH990.33
You save:  DH297.13
L1,231.95
List Price:  L1,760
You save:  L528.05
ден3,957.99
List Price:  ден5,654.52
You save:  ден1,696.52
MOP$562.43
List Price:  MOP$803.51
You save:  MOP$241.07
N$1,273.79
List Price:  N$1,819.78
You save:  N$545.99
C$2,572.13
List Price:  C$3,674.63
You save:  C$1,102.50
रु9,330.17
List Price:  रु13,329.38
You save:  रु3,999.21
S/260
List Price:  S/371.45
You save:  S/111.44
K271.59
List Price:  K388.01
You save:  K116.41
SAR262.46
List Price:  SAR374.96
You save:  SAR112.50
ZK1,777.13
List Price:  ZK2,538.86
You save:  ZK761.73
L320.28
List Price:  L457.57
You save:  L137.28
Kč1,590.03
List Price:  Kč2,271.57
You save:  Kč681.54
Ft24,925.85
List Price:  Ft35,609.88
You save:  Ft10,684.03
SEK kr750.08
List Price:  SEK kr1,071.59
You save:  SEK kr321.50
ARS$62,063.63
List Price:  ARS$88,666.13
You save:  ARS$26,602.50
Bs483.56
List Price:  Bs690.83
You save:  Bs207.27
COP$266,463.69
List Price:  COP$380,678.73
You save:  COP$114,215.04
₡35,817.30
List Price:  ₡51,169.76
You save:  ₡15,352.46
L1,723.87
List Price:  L2,462.78
You save:  L738.91
₲524,369.02
List Price:  ₲749,130.70
You save:  ₲224,761.68
$U2,697.33
List Price:  $U3,853.49
You save:  $U1,156.16
zł274.39
List Price:  zł392.01
You save:  zł117.61
Already have an account? Log In

Transcript

Hello, in this video I will explain growth exhibition in ADF business component here I have created a simple ADF application was departments and in between entity and the board meeting to believe use graphic separation actually you can use the group exhibition to get some value or to set some value in easy way instead of writing some code. To do that, you can just simply using a groovy exhibition for doing this. In this video, I will give us the common groovy exhibition we almost use and I will show you how you can get some information if you are in the master and you will need to get some information from detail. Or if you want to get from the detail need to get some information from the master. You can use groovy expression. Here I have the department's view and I haven't believe you and there is a link between departments And in between.

If you open the application module you'll find the parameters a muster and in buoy as a detail. Because of series, a relation between the bottom end and the buoy, there is a link between both of them, you can use this link to get some information. If you are in a monster grant, get some information from the theater. If you are in the detail, you can get some information from the monster using this link. I will give you some example here. If I am in the department view, and you want to get the number of you remember, Louis, as I told you, we have a monster department and the detail in Billy.

So if you want to display the total number of employees in each department, how you will do that. You can easily create an transited repute and to go to the shop for programmatic way and the There's one SELECT statement to get a count of your employees, but here is a group exhibition, it will simplify all this good. So, what you can do I will create here a new attribute I am insert department now, I will create here a new attribute and I will call total number of employees okay and this will be integer let us ask you to do something else if you want to get the total also submission of the Olympia Louis salary. Now I am in the department and I need to get the submission of my all of my employees. I will add another attribute here and I will show you how you can get this total in Billy's salary and we can we can make it double okay.

Okay so now I want to get some information for my detail. I am now in the master and I need to get some information for my detail. The first thing I will go I will do is I will go to the link between the department and the movie okay so where is actually the link who link is a movie was department you will find here this is a in between department link. I will go for the relationship here. This is a relationship is based on Association I will edit his accessors this is accessory which you can use to get some information. As you can see here you can get some information from industry using embu View accessors.

So I will copy this in believe you accessors name is already enabled, or you can get it if you are in the department of view, you'll find here, view link accessors. If you expand it, you will find here St. Louis view, this is accessor name, which I will use to get some information from my detail. So, let us now take Coby from this employee view, there are two ways you can go to the link and you can edit the accessors and you will know that this is an accessor name. If it is not generated, you have to generate it if you want to get some information from the deity. Okay, so I will copy the accessor name. And let's go to the master my department.

Here's the total number of employees I need to get to two numbers from Louise. So I will go to the exhibition devaluating exhibitions that you've cultivated Yu Xin a select function here, here, I will use my accessor to get the total number you can read count. And to give the attribute name, which is MVP, primary key ID count off in MVP ID. If you back into here as reviewed you will find a blue ID is a primary key. So I will pack again here and paste it here it is already there. I wrote it.

So, this is how you can use the accessor between master and deal to get the count of your details. This is one of the usage how you can use the link between two view object to get some data from one Sort of detail oriented from us. The second thing I need to get it from my detail is I need to get as the total employees salary. So, I will create accurate a transit attribute and I will do go to exhibition again here and function I will use my accessor name dot sub and write your your attribute is the MVP which you want to get the sum of course, it should be numeric attribute otherwise you will get error I will write here salary like this. So, you will use your accessor name dot sum and the gives it a attribute is a detail which you want to get the sum of the attribute in our example here it is a salary attribute in the employee.

Your your point here salary attribute and it is Have type numeric Okay. So now I am in the master and I can easily get the number of my detail or I get a submission of any attribute in more detail. Let us go to the detail and I need to get some information from my master now I am is a Bluetooth for example I need to display the my muster or my department name. Okay so are you what you have here already the department ID you can carry it list of value over it and displayed in the page or you can create a transient and go to Java and executor. You can get it from the master but it's a groovy expression It is simple. So as to as as we did in the department, so master First we will go to the link which will link the employee to department okay Here and here this is accessor name here, how you can access your department it is not selected.

So, the first thing you should do you should select this otherwise you will not be able to get any information from your Bureau. So, I will select this and he gets access or new copy, please okay so let's go back again to the movie. Here I will add a transit attribute called call a my report mean name, it is a string okay and I will go to 40 separation function or you will use accessor name, my parent accessor name, dot and you can write any attribute from your parent in attribute you want from your parent. I have divorcement him so while you were right here department name so this attribute name in my appearance, or use accessor. Xin in my appearance, I will use the attribute name so using the group exhibition now you have access to all attributes in your beer and you can get location manager birth name anything from your parent using groovy expressions like this groovy expression can use for you for as well in new main or your, your view object itself.

No need to get permission from the parent or get information from the child. No, you can use the graphic separation in size of the object itself. For example, you have here first name and last name. If you want to display a full name, first name, last name in one attribute, instead of having to attribute there are many way you can do this. You can go to the query and add inside the query itself. Another attribute to get the first name inculcate last name or you can create a transit attribute and in Java is the getter of this attribute you can say get in first name plus get a last name, but I will show you this time how you can do it in the groovy expression, which will simplify is this thing is so, I will create here new attribute, transit route, grid full inventory full name and full name this is drink.

So, what I can do, I will go here in the exhibition and you can simply right straightaway, because of I am in the same view object. I don't I will not use any accessor name or you will not get information from the parent or child No, I am in my view object you can straightaway write the attribute name. So why you will write here first name Plus, I will give space plus the last name. So, first name and last name is is in between attribute exists here is attribute first name last name. So I would just easily write first name plus last name. Okay.

So, what I will give you one more example for example, if you need to make some calculation, like here's the employee has a salary Plus he has a commission. So, if you want to get the total income of this employee, so, I would create here a new attribute or you call it total income and you need to make some calculation or this is can be same big decision like salary and commission. So actually how does the total income kind of calculate, if the employee has a commission, we can say, salary multiplied by Commission, the loss of salary, this is will be the truth income. So to calculate the to exist calculation you can use a graphic solution as well. So I here I created a projector view called Total employee income. So this is this is the commission percentage let's copy this attribute because we will use it and let us go to the expiration function.

So, what we can say we can see salary multiplied by commission plus a salary. Okay, I exist. So, salary multiplied by commission plus salary, this is what gets the total income of your of the interviewee. But there is the problem here. If the commission or the salary is not you will get an exception you will get an error so You have to write some if statement here. So right here if the salary not equal now and commission not equal now okay is that case we need to secure this need to run this okay you can make something like else you can return center so you can write code like this we call it if accelerate not equal not and the commission record not sir you want to blood commission blesses salary in case if most of them not equal not anything anything else you can return justice sir and the race okay So we have now some groovy exhibition we did.

From the detail we get information from the department name or insights of the object itself, I did some calculation between the view object attribute and from the muscle I get some formation statistics from the child. Although the last thing we can do is for example, if you have a date and you want to see the default value of zitz, the two is the current date, there is a group exhibition you can do this. So we can go to the exhibition, I am now is a higher date. So it is a five date or timestamp. So in the exhibition you can easily write EDF dot current date. This group exhibition will sit the current date as a default value for the selected attribute.

If you want to define we can write EDF to call it date time or if you want it only you can write it if to current date we did a lot of group exhibition here. So, I think let us if you have any exhibition room, just make rebill if you find any error here like this it means zero is one. One expression has an error. As you can see here in blue we ID of type department. This is as you can see here, this is an issue in one of the groovy expression. You can go to those a department view and see where is the executives x the error come from?

Is the employee salary here does it Zack suppression to check as you can see here we use employee ID which is wrong. We have to use the accessor name which is in Billy's view. So let us reuse in Billy's You do some salary and it'll rebuild again. Now we have zero errors zero warning it means all the separation which we wrote is correct. So let us now create a simple page okay so let's just call it groovy and this beach little drag and drop the department and in buoy carries so it's it was a burden splitter. So it is here drag city apartment you want Okay and let us track the detail which is in between view three as a table okay so a little strong and cigs a groovy expression okay so, let us now have a look of our groovy expression now I am in the Master, I have here total number of employee.

One as you can see if select is you will find here to six. So now you display total number of employee using groovy expression and using accessors the link between both those of you okay You use it to get the total number of GUI plus you will find here a total employee salary if you find here just below e salary, you will find four sets of 400 if you go for the two employees is a salary 13,000 6000 So, it is 19,000. So, here you will find the total submission of the salary and the total number of employees This is in the detail level. So, let's jump into the studies This is from the parent to city level. So, this is go to the detail you will find here we get the department name you will find here once you select the department, you will find my department name is the selected department.

So, I use an accessor name and the link between the muscle entity to connect the from the detail and to get any information from the master using groovy expression. This is inbuilt. Full name in bluie full name as you can see here, sorry here, first name is then and last name says you will find here is can quit a concatenated like this. Plus here's the calculation the total income, we can you will find here the salary is live in K, there is no commission so is a total income or visa seller, as you can see, but if you have any commission like in the department at sales, sizzle has a commission so you'll find that here you have a salary but you have point for Commission and the total income will be like this. So now I use a groovy exhibition. To make some calculation inside my view object attribute itself.

I use groovy acceleration to connect To my parent and to get some information from my parent I use groovy separation in my parent with some some statistical information for my child. And the last thing is I need to use some built in operation which is date as you can see how your date is. We didn't add here accurate insert so this is adequate insert here and let's create a new row and the chick gives a higher date is a default boys according to date or not. So I will go here in the detail and it does tracks accurate insert operation of the blooey as a bottom and let us try to run again and it checks the created cert. It will sit the hire date by default to my current date or not. Okay, so now are you We'll test is a create insert here this is my hire date this is basically it insert, you will find the current date is by default setting set in the hire date using groovy expression.

So from this video now we learn how we can use the accessor which is the link between master detail to simplify getting some information from Sabir on to get some information from his child or from the child can get some information from the bureau or even how you can use group exhibition between the view objects attribute itself and how you can use something in operation Ruby exhibition and ADF business component. So, this is how you can use some quick example of groovy expression which we are mostly used in ADF application because the video will jump to another feature. So see you next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.