0
1
00:00:04,326 --> 00:00:05,477
<v ->In previous lecture we learned</v>
1

2
00:00:05,477 --> 00:00:07,490
how we can make search in our database
2

3
00:00:07,490 --> 00:00:10,950
and in this lesson we are going to list our books.
3

4
00:00:10,950 --> 00:00:13,419
We will sort by All Books in library
4

5
00:00:13,419 --> 00:00:15,669
and Borrowed Books, right.
5

6
00:00:15,669 --> 00:00:18,053
But before that what we need to do
6

7
00:00:18,053 --> 00:00:22,990
we need to, here, don't have any borrowed books
7

8
00:00:22,990 --> 00:00:27,920
so here I will go to my database, okay.
8

9
00:00:27,920 --> 00:00:31,443
And, here, for example one of them, we can do that.
9

10
00:00:32,370 --> 00:00:35,540
What we will do in books, browse data,
10

11
00:00:35,540 --> 00:00:38,877
so status can be here for that one,
11

12
00:00:38,877 --> 00:00:41,340
I will make it one, okay.
12

13
00:00:41,340 --> 00:00:44,300
One means borrowed, okay, taken book.
13

14
00:00:44,300 --> 00:00:48,510
And now, let's say yes, okay, or cancel
14

15
00:00:48,510 --> 00:00:50,663
let's say Write Changes and after that.
15

16
00:00:52,130 --> 00:00:53,070
Let's close it.
16

17
00:00:53,070 --> 00:00:55,710
Now what I need to do, I need to find
17

18
00:00:55,710 --> 00:01:00,710
my List Bar, it's here right.
18

19
00:01:01,400 --> 00:01:02,876
And remember what we have here
19

20
00:01:02,876 --> 00:01:07,080
for Radio Button one its variable,
20

21
00:01:07,080 --> 00:01:10,365
it's value of variable is one, two and three, okay.
21

22
00:01:10,365 --> 00:01:15,110
And here, what we need to do, we need to find our button,
22

23
00:01:15,110 --> 00:01:19,280
it's here, and here I will create Command Property,
23

24
00:01:19,280 --> 00:01:22,713
Command is equal to self dot,
24

25
00:01:24,770 --> 00:01:27,073
list books, okay.
25

26
00:01:28,120 --> 00:01:29,257
And after that what I need to do,
26

27
00:01:29,257 --> 00:01:33,440
I need to create this function, right,
27

28
00:01:33,440 --> 00:01:36,723
and here, somewhere here, I will create it.
28

29
00:01:39,160 --> 00:01:43,300
And here is fine, I will say def list books, right.
29

30
00:01:43,300 --> 00:01:45,250
And here, what we need to do, firstly
30

31
00:01:45,250 --> 00:01:49,003
we need to get our value off this,
31

32
00:01:51,980 --> 00:01:54,700
from, let me show it, it's here right,
32

33
00:01:54,700 --> 00:01:58,160
we need to say it is, like value of List Choice,
33

34
00:01:58,160 --> 00:02:00,180
right, and dot get,
34

35
00:02:00,180 --> 00:02:02,550
and if it is one that means All Books,
35

36
00:02:02,550 --> 00:02:05,450
we need to list all books, if it is two
36

37
00:02:05,450 --> 00:02:07,847
our value is two the books In Library.
37

38
00:02:07,847 --> 00:02:11,450
If value is three Borrowed Books, okay.
38

39
00:02:11,450 --> 00:02:15,073
So how can I do that, her I will come, and say,
39

40
00:02:16,120 --> 00:02:19,987
value is, equal to self dot,
40

41
00:02:21,730 --> 00:02:26,050
list choice dot get, okay.
41

42
00:02:26,050 --> 00:02:31,050
And after here I will say if value equals equals one
42

43
00:02:31,860 --> 00:02:34,507
that means I will list all the books, if,
43

44
00:02:38,930 --> 00:02:40,087
value equals equals one that means
44

45
00:02:40,087 --> 00:02:42,630
I will list all the books, so what I will say,
45

46
00:02:42,630 --> 00:02:47,327
all books is equal to cursor dot execute
46

47
00:02:49,560 --> 00:02:54,293
and simply I will say select star, from, books,
47

48
00:02:58,400 --> 00:03:00,440
okay, all of them, and after here
48

49
00:03:00,440 --> 00:03:02,913
I will say fetch all, okay.
49

50
00:03:02,913 --> 00:03:05,050
And what I need to do, I need to say
50

51
00:03:05,050 --> 00:03:09,923
self dot list books, okay, my list
51

52
00:03:09,923 --> 00:03:14,923
and delete zero until end, and after that here,
52

53
00:03:18,170 --> 00:03:20,950
what I will say, like before I will create
53

54
00:03:20,950 --> 00:03:24,350
a Count Variable, count is equal to zero
54

55
00:03:24,350 --> 00:03:29,350
and for, book in all books, and now
55

56
00:03:31,820 --> 00:03:36,400
I will say self dot list books dot insert
56

57
00:03:38,230 --> 00:03:40,507
count variable, and after it here
57

58
00:03:40,507 --> 00:03:45,507
I will say CTR book ID, for book ID, book zero, right.
58

59
00:03:48,190 --> 00:03:50,567
And after it here I will say plus,
59

60
00:03:50,567 --> 00:03:53,818
again I will use thing here, and again plus,
60

61
00:03:53,818 --> 00:03:58,818
I will say book one, okay, and this will be book.
61

62
00:04:02,440 --> 00:04:04,792
Okay, this is for first one is fine,
62

63
00:04:04,792 --> 00:04:08,150
and here I need to increase my count variable,
63

64
00:04:08,150 --> 00:04:12,100
count, plus equals one, right.
64

65
00:04:12,100 --> 00:04:13,017
So what's wrong here?
65

66
00:04:13,017 --> 00:04:18,017
Books, it must be book, and this one is book, okay, fine.
66

67
00:04:18,450 --> 00:04:20,140
Book and book, okay it's good.
67

68
00:04:20,140 --> 00:04:24,159
So this is for first value, value I will say now here,
68

69
00:04:24,159 --> 00:04:29,159
elif, value equals equals two.
69

70
00:04:31,850 --> 00:04:35,060
If it is two that means I will list
70

71
00:04:35,060 --> 00:04:37,490
the books in my library, right.
71

72
00:04:37,490 --> 00:04:42,490
So here I will say books in library is equal
72

73
00:04:46,100 --> 00:04:49,163
to cursors dot execute.
73

74
00:04:50,020 --> 00:04:52,740
Now here what I need to do, I need to use
74

75
00:04:52,740 --> 00:04:56,090
another query right, this is something different so.
75

76
00:04:56,090 --> 00:05:00,843
I will say here select star from books
76

77
00:05:05,059 --> 00:05:10,059
and where, I will say book status,
77

78
00:05:11,040 --> 00:05:15,267
now we will use book status, book status, equals
78

79
00:05:16,490 --> 00:05:18,730
question mark, okay, and after it here
79

80
00:05:18,730 --> 00:05:22,350
what I need to do my books status will be zero right.
80

81
00:05:22,350 --> 00:05:25,174
And I will say here zero and comma, okay.
81

82
00:05:25,174 --> 00:05:30,174
And after it here I will say fetch all here.
82

83
00:05:30,570 --> 00:05:32,560
Book status is not a variable okay
83

84
00:05:32,560 --> 00:05:35,759
we already know it should be one or zero
84

85
00:05:35,759 --> 00:05:38,380
so I don't use this here variable,
85

86
00:05:38,380 --> 00:05:42,330
and I will say book status is equal to zero, okay.
86

87
00:05:42,330 --> 00:05:44,813
for other one, for option three
87

88
00:05:44,813 --> 00:05:48,530
here we say book status is equals,
88

89
00:05:48,530 --> 00:05:51,237
equals one, okay, for borrowed books.
89

90
00:05:51,237 --> 00:05:54,220
And here what I need to do, like before,
90

91
00:05:54,220 --> 00:05:59,220
very similar I even, I can copy this guys, all of them, yes,
91

92
00:06:01,338 --> 00:06:05,802
and paste them here okay, everything same.
92

93
00:06:05,802 --> 00:06:09,370
Only our query is different for I will say here,
93

94
00:06:11,435 --> 00:06:16,435
books in library right, books in library only,
94

95
00:06:19,610 --> 00:06:24,450
and this that, list books delete.
95

96
00:06:24,450 --> 00:06:27,820
And here, yes, all fine.
96

97
00:06:27,820 --> 00:06:30,650
And for option three I will use else,
97

98
00:06:30,650 --> 00:06:32,270
of course we can use elif also,
98

99
00:06:32,270 --> 00:06:37,270
but I will use else, and here I will say taken books,
99

100
00:06:38,870 --> 00:06:43,870
taken books is equals cursor dot execute again
100

101
00:06:46,320 --> 00:06:51,100
and here it will be same, select star from books
101

102
00:06:51,100 --> 00:06:54,670
where book status is equals one, okay.
102

103
00:06:57,370 --> 00:06:59,823
Very similar so I will copy this guy,
103

104
00:07:03,752 --> 00:07:06,193
and here, this one only, paste it here,
104

105
00:07:10,624 --> 00:07:14,924
and this time status value will be one, on simply, okay.
105

106
00:07:14,924 --> 00:07:17,580
And after that here what I need to do,
106

107
00:07:17,580 --> 00:07:22,403
very similar, copy this guy and selects, what's wrong here?
107

108
00:07:22,403 --> 00:07:25,792
It's fine actually, so I will paste it here.
108

109
00:07:25,792 --> 00:07:30,792
What I will say, I will say for book in taken books, okay.
109

110
00:07:33,150 --> 00:07:35,757
And if I run my application now, so,
110

111
00:07:38,650 --> 00:07:43,330
I will say All Books, list All Books, as you see it's here.
111

112
00:07:43,330 --> 00:07:47,471
And if I say In Library, you see, now we have four.
112

113
00:07:47,471 --> 00:07:50,420
If I say All Books, it will, be five
113

114
00:07:50,420 --> 00:07:52,694
because Power of Positive Energy is taken,
114

115
00:07:52,694 --> 00:07:56,270
and if I say Borrowed Books, you see,
115

116
00:07:56,270 --> 00:08:00,880
Power of Positive Energy, and details of book is,
116

117
00:08:00,880 --> 00:08:03,290
details of book are here.
117

118
00:08:03,290 --> 00:08:06,323
Okay, for now that's all, see you in the next.
