Part 6 openDocument reports

We create an openDocument report and fill it with data. Also some tips and tricks on how to get help in constructing ocl expressions and how to see cross reference where things are used throughout the model

To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now you can pick any topic to be instructed without watching the whole video.


Reports View Model Editor: •Columns needed for Report • Template URL • Report File Name Model Access Form Open document text Class action for show View model root object requirement Open document report show command Tags in odt template in Word Some expressions on setting the date “Used by” cross reference index

Raw subtitles text

Hi welcome back this is section 6 of  MDriven designer overview

let's do reports, reports are really only collections of information

presented in, a well usually a paper or

something that we consider a document

so as this is the case it lends itself to

the view models just like any other

things we have looked at given the fact that

so let's add a new view model and

say that this is our report

of course we need to design, what it

supposed to hold, but what if it would be

and what if it would be a bill to pay

the rent as such it would probably be rooted in

the lease contract, so that we will call

this "rent bill report" and when it

comes to report we have a a shortcut

to add a few things that are important for

reports, add columns needed for report

so let's start with that one

we've got a template URL and a report name

so these kind of reports I'm going to

show now and is the kind that we recommend

there it was another kind of reports, but

I'm not going to talk about it and

this that I'm going to talk about is based on

the open documents done that Microsoft

submit to identification and which is

pretty good it's really very much

office as a next step open xml format so

the report file name

we need to actually say what the

resulting file is gonna be named and the

template URL is where we can find a

template to fill with data, we're going

to look at all this, but let's just add

the other data that's needed in the

report, so the apartment number

most like the rent of course, start

date of the contract and maybe we also

want the period of the rent, so maybe

this isn't rooted in the lease contract,

maybe, this happens to me all the

time that I haven't fought out my

problem it isn't finished I need to work on

it as I design the other aspects going

into the domain, so "Billable Period"

this would typically be a a month or

something maybe as a start date that is

date time and the end date and the

lease contract has many billable periods

and then heading back to my report, this

shouldn't be rooted in lease

contract it should be rooted available period

right, but then these

expressions aren't valid anymore, because

they need to follow the link up to this

contract, like that, so I can take lease

contract is gonna be the same change

like that and as you see it

automatically builts this UI, but it

doesn't really let's see what's wrong

with it two dots I was wrong and but I'm really

not interested in building a UI, so that

UI hints I see here are really just

disturbing for reports so "use placing hints: no"

not for this report, then it's a

cleaner way of looking at the just data

so if I have the apartment number the

rent and start date and end date I'm

sure what, yeah this is the start and the end date

of the lease contract, but these are

actually more like it and I would want

them all of the Billable Peiod, like that

and of course we need the name of the

person living here and  I get

I get the columns back to

lease contract, but it doesn't allow me

to navigate further than that, this false

trackway, so I need to find another way I

just add a generic column like that and

when I set the expression and I'm free

to type what I need one way is to have

the model access work for me, model access

actually brings up this diagram in the

context, that we were billable period and I

know that I want to go to lease contract

and I want to go to person

watch up here as I click the

the navigation, as I do a navigation

expression is built for me, so now

I'm on lease contract, but I want the

person that was called tenant and

on the tenant I would like the full

name, so now it has built something that

I can just copy like that and I can paste it

this wasn't exactly what I want because

I was billable period, so what I really

just one was to say "self" and lease

contracts and tenants and I didn't

actually want to select full name, I wanted

to have a full name, so doing these

justifications, so that's one way to get

help to build up the ocl

expressions, while navigating around in

your model, so now would want to name

this the full name maybe, so we have covered

this and we have covered that, but we

also want to cover this, so if the person

has multiple rented apartments

he must know what this bill is

regarding, so let's add another generic

column and following

that, let's do it the same way with the

model access, we are on a billable period,

we want to move up to lease contract, but now we want to

move to the house instead and we want

to have the street number

copy that and paste, and same here we

actually already was on a billable period

just stated self, I can see that the

context that we entered in expression is

billable period that's because we have

billable period as the root of our view model

so when I, also same here, I don't want to

select the street number I want to add street

so house street and yet another column

was gonna add a generic column like that because we

are not done, we also need the street and eventually

the city, so let's go ahead and you

can just do it this way

I go to lease contract from lease contract

we go to roles, rented apartments

and from rent apartments, we go to tenants

the street and from street we go to name

that would be another way to navigate

create the correct ocl expression

the street, and they're going to copy

this copy use the menu, so you see what I do

copy and paste, name this "the city" and from

the street don't want the name I want to

follow the role to city and grab its name

this is one way to get some flat data

but quite often you want to have lists

in reports, so let's bend over backwards to actually get a list in here

somehow, but let's say that on the bill

we also state who else lives in the

building just to get the need to get

to get them a reason to have a list in

our report, so I could do that by adding

nested View Model class full of

multilinks, but since the context I'm

in the billable period, doesn't have an actual

many association that would build our

multilink that we are only offer the

billable period all instances, so we're going

to do this manually instaed and

add generic column and add

a nested view model class, add other nested view

model class and we state nothing about it

so this column is going to be associated

to this nesting, so pick that one there

and then I get this arrow saying that

this will be detailed here

depending on what it is of course, so from

from the billable period move up

to lease contract, from lease contract and

go to the house and from the house go

back to the tenants, that will be a that

would be a list of all the other people

including myself that live in this house

and that would be a collection of person

right, so this messing should really the

of type person and  we can call it

"persons in the house"

let's call this one "persons in the house"

so all names

as columns need to be unique and all

nestings and the root must be unique

within themselves but we can reuse names

here between a column a nesting, so now

we're person and we will want to state

something about the person  on the bill

the full name, like that, so many persons

persons in the house, full name

yeah that's the data for our report but

we're going to want to build a report

as well, so we need a template URL and in

the long run this will be you a template

that situated in some internet site

somewhere, but since we are only working

locally on prototyping we on a

user standard file of some sort

and let's see where I had saved this

file it's temp\DemoModel, so let's put

I'm going just do a string here,

hardcoded string, c:\temp\DemoModel

report them late and since this is

using the open document standard and it

has the extension open document text .odt

if it's a word like report, so I'm going

to copy this and say okay on that, and I

wonder if I need to double slash these

because otherwise, it will be interpreted

as state escape sequence for the

string, so like that and now I'm gonna open

and what I really want to do is

start word actually, so that's what I

should do, save as here

gonna call it ODT like that I don't think I should have odt

there because it will be double, save

so now I have an odt okay and just to

get started we have a special tag what

we gonna do is do some report designing

and to actually poor in data here, we will use

percent and some tag that actually will

be the tag from the viewmodel, the name

from the viewmodel column, but since we

don't want to copy and paste these

we can start with generic one called %meta%

what this does is actually just showing

all the other tags save and another thing

is the squiggly lines denoting

miss spelling, it can some times

mess up our tags because in the xml file

these will be free separate notes

so let's head back to alternative settings and on the, I guess,

the language control and we say hide

spelling errors and I'll hide

grammatical errors in this document

yes, so I'm gonna save that and then this

other one we needed for that is what the

reports going to be called and again I

could just do a string, but we want some

data as well, so let's do a combination

bill for apartment and then we can

I'm gonna copy this one apartment number

asstring, because that was an

integer and then I want to append the

extension as well, so that we can open it

okay,like that let's see how we can invoke this if we

are back on our design that we're going

to refresh the model just so we know

what we have show all houses or other

show all persons ok we have a person, but

we don't really have anything on a

person, so let's just quickly add a

viewmodel to handle something that is rooted on the person

person view, we say it's a person, we say that we can see

the first name and last name and add some nestings

what if we were to add a nested singlelinks

okay we don't have any for it

multilink would create and delete this

is a quick way to enter the townhouses

so what happened was that it added some

actions to create the house and delete

the house as buttons show up here

what can we add something more?

the rented apartments guess

undo that control, I'm going to add nested

multilink with picker add and remove

rented apartments that was like

different it added a picker and add

a remove button, I want to show something

in these grids, make that one

a little larger, add a column

okay, so I'm gonna leave that as string

and instead head over to the house and watch

the default string representation, is actually, we did that

already, so that will be good for us and

for the rented apartment and that's the

house as well ok and for this one so that's nesting

and as the house as well okay,so I'm gonna add an action, so that we

can bring this one up, so what we're

going to do now is add a class action

for show, whenever we have a person

somewhere in the UI and we should be

able to show this view, that will show up

here, as a view person view

and if I double-click it I get selected here

so did a few things just to get us

going to refresh the model and show

all persons and now when I click on a person

I get the view persons view and if I

hold ctrl while I click it I get a new

tab with that person and Delsie Bad and

we can add her as a tenant and

this one and save that, we can also say

that she, we could create the house that

she owns, so that for real I guess we

added that in the default string representation

okay, so she rents here and then we got

this one show house from object

where did that come from remember I don't

it was a class action on the house

that brings up the house view, so that

will help us navigate to here, where we

see that the Delsie Bad is now also a

tenant of this, so these are the lease

contracts it would be good if we could

enter their rent or manag the billable periods here, so that was the house view

so let's look that up, the house view

and now we are suffering a bit from too

small screen, we can always zoom in to

watch details, but it would be good if we

could see it all like this alright, so yeah

we have the rent over there, but from there the lease contract and

we would like to be able to add or create billable period

so here I'm gonna add a nested view

model with create and delete for

billable period, of course I can do all these

expressions by hand, but these are just

snippets that we have found that are so

common that it's good to have them

done already, so what I did now was that

these things we are going to write

the billable period here,the same as

a presentation just hyphens to make

it as string and the billable period is

in the nested list here which is the

grid, so let's add column, I know it's

outside your screen, but I guess you know

this point out start and end date and

removed as string, like that and if

we head back and refresh the model

and we show all houses, we picked that

this one, we also have a way to set

billable period, we're going to create billable period

and now when we have billable period we would

like to do a bill for this person in

this house, for this billable period, right so

and last I'm gonna do that, well

there's something wrong here

let's see what it said view person view warning the view model does

not require a root object, so that's that

the systems telling us that since we

have this person view that we created

that apparently needs root objects

that we set it with the view, person view, but we haven't stated that it

requires root object on the view and

we should do that just to let the system

know that we are on top of things and we know what we are doing

so requires root object and if

I save and adhance and update that once again they are gone

it's from the warning wanted to do was probably to add a class

action this one and it should be on the class billable period and

let's call it Generate Bill and the executed expression on this one

so this is where all obvious down to something

self, we are billable period and we want to open a document report

open document report show that's the one

we want to do and this needs a viewmodel

and that has the date that one we did actually

so we could just enter the name here on

that the in hyphens but that would not

be very good if we change the name later

on, so it's better to be strictly

typed and go on the constant that we

have, billable period, that's the class that

it's rooted in and we have view and I

press "ctrl + Enter" to get up this little

tree that I can just copy from to

lessen my mouse movements, view models

and from that one I see that we have one

that calls rent bill report

ok so that's what I want to do with this

one, so whenever I have billable period this

action should show up, saving again and

the heading back over here let's save

this one, errors in the information

what do you mean? well the Delsie Bad must have an

apartment number and the Delsie Bad lives free

ok let's fix that then she lives an

apartment five and she still lives free

now she's gonna pay 100 and she's gonna

have a billable period, so but we need to refresh the

model and show all the houses and now

for the Delsie Bad, for this billable period

let's say it start 10/1/2016 end 10/31/2016 and when I click that,

when I get there the action since I'm now on

billable period save generic bill and

then it says errors and why, reference

not set AsByteArray and reproducing opendocument report

ok I went offline and checked it out

it turned out that since I had word

opened the template was locked

and that was the error I got from that

album, make a note of that to make it better

every statement it generate the

bill, now that I have closed to the

template in work, like get to word to

open up this so remember that

there I said that the percent meta

percent just would provide all the other templates for me

so this is the resulting report not very

good-looking, but I'm gonna copy this tags

because that's how we can pour in

our data, going to open the report

template again, so that's the template

now I'm not that interested in the

meta-thing, more interested in the data as

such, the template URL and the file

name is not interesting to me, but the

apartment number, so bill for apartment number

and then I can guess say that should be

debt and these pay dollars for the period

starting at and ending at

and of course, we are free to style this

any way we would like and just to provea point, we going to

we also have the let's save

this one and close it and that was a

report we generated and generate a

new bill and now we get this bill for apartment

bill for apartment number five

in the house at Grastensvagen

please pay a hundred dollars for their

period starting at the date and ending

at the date and we got the date time as well

we should fix that, but what

about the listing all the other tenants

in the house that we wanted to do

open up the template again

that was the report and this is the

template, and that looks like this

it's the different tag %% + persons

in the house and that's actually if

we head back to the rent bill report as

the persons in the house that's that column that nests

so how do we go about creating a table

rate, table let's do like that

Other people in the house where you live at

and of course we could use to the same

tags multiple times, so to actually this

role should be replaced over and over

depending on each person, so we do that

by setting this tag as the star tagged

in the row and then what we

actually want to show in this cell is

the full name and also lives with you sort of

so that's how we would go about getting

the effect, if we close this one and head

back and generate the bill we get

other people in the house where you live

in Grastensvagen - Hans, Dick, Delsie, so

and that's how you can do reports really

easy and it's working with the excel as well

excel like files than the extension is ods

open documents spreadsheet to fix this

to more format, that we would like, we

would head back to the report data and

say that we don't actually want to

communicate these as and as date we

would like them as strings instead and

then we can use to c# syntax for 2

ToString that takes a parametr that is

a string, that sort of helps us design

the value, I think it's like this small

"y" for the year, four letters, four

positions, four digits and that it must

be enlarge for the month because the small one

are reserve for the minutes I guess

copy that and I going to use the same on

the end date, like that, saved that head

back to the prototyper, refresh the

model and show all houses, double-click

on the house to get the first one or two

get their first view, get the first

action that navigates to view which was

this one house view, like that

and pick tenants by search we could add some

more at these, ok save let's say there's

errors because they don't have apartment

numbers, but that's okay

for me, I can live with it

ok, so this didn't turn out the way

I want to add, why not

well because I hadn't entered anything for

the Dick Smith it was for the Delsie Bad

so I'm going to generate the bill for her as well

then it's looks ok, good, as you see

this was apartment 5 but this was

important 3, so we haven't mentioned the

name in the report of course we could do

that as we have the data in there

it will be the same

just using this tag called "tenant full name"

so now we have done a few things

with our little model and one thing that

I really want to point out is that as we

do everything in the model the model

also knows everything, so if I were to right-click their rent

let's see if we can get this on screen somehow,

if I want to right-click the rent here

and "used by" then I directly see that the

the lease contract rent is used in a

constraint, ok it's also used in a

viewmodel column for the house view the

lease contract rent, it's also used in

the "rent bill report rent", so this really

is a cross reference for everything in

our model, that comes only when we

actually used to model for everything

now we have the total control of what

should happen, if the rent need to be

the concept of rent, the attribute of rent

would need to be changed in any way

where does it affect and I can have

click these straight off the lease

contract rent and the lease contract

is selected for me in the tree and I

can check the constraints for it then

and find that this constraint of

course use the rent right or wrong

that so that's real and good effect

so let's finish up this session here and

in the next one we're going to look at

images to have images and fights

uploading and downloading files etc.

so thank you for listening and I will be back

This page was edited 47 days ago on 02/10/2024. What links here