The 1000 steps program to MDriven Chapter 10
No edit summary
No edit summary
Line 42: Line 42:
|}
|}


=== Correct errors if you have them, set Link Role names on Association classes, Create open-document reports ===
=== Correcting Errors (if you have them), Setting LinkRole Names on Association Classes, and Creating Open-document Reports ===
302 Create some intentional errors for example by renaming the CartransferOwnershipDocuments to CartransferOwnershipDocument - save and practice to follow the error leads from the red dots - and fix the error.
302. Create some intentional errors, for example, by renaming the CartransferOwnershipDocuments to CartransferOwnershipDocument.  Save and practice following the error leads from the red dots, and fix the error.


303 Create some intentional errors for example by changing the expression of a class action on Car - save and practice to find the error from red dot - fix the errors - save - ensure clean model with no errors.
303. Create some intentional errors, for example, by changing the expression of a class action on Car. Save and practice finding the error from the red dots. Fix the errors, save, and ensure you have a clean model with no errors.


304 Find the link class HistoricOwnership - select the association and change from <Default> to HistoricOwnerships (with a plural s) in the LinkRoleName on both Association ends for the associations. Save - see the errors.
304. Find the link class HistoricOwnership. Select the association and change from <Default> to HistoricOwnerships (with a plural s) in the LinkRoleName on both Association ends for the associations. Save and check for errors.


305 Fix the error by clicking them up - and update the expressions to reflect the new name HistoricOwnership -> HistoricOwnerships
305. Fix the errors by clicking on them and updating the expressions to reflect the new name HistoricOwnership -> HistoricOwnerships.


306 Drop the ShowCar action that does not have a ViewModel to show
306. Drop the ShowCar action that does not have a ViewModel to show.


307 Create a New ViewModel called ProperCarView, set the Class to Car, Set Requires Root.
307. Create a New ViewModel called ProperCarView. Set the Class to Car, Set Requires Root.


308 Add a Class Action to bring the ProperCarView up
308. Add a Class Action to bring the ProperCarView up.


309 Show the  RegistrationNumber in the PropertCarView by adding a column
309. Show the RegistrationNumber in the PropertCarView by adding a column.


310 Add also the State, BrandOfCar, CarOwner - make them static to avoid edit
310. Also, add the State, BrandOfCar, and CarOwner - make them static to avoid editing.


311 Add the Multilink for CarTranserOwnershipDocuments as grid
311. Add the multilink for CarTranserOwnershipDocuments as a grid.


312 Add columns in this grid, Seller, Buyer, remove the AsString default column
312. Add columns in this grid, Seller, Buyer, and remove the AsString default column.


313 Start the web prototyper , search cars - open the PropertCarView on a Car that has CarTranserOwnershipDocuments
313. Start the web prototype. Search cars and open the PropertCarView on a Car that has CarTranserOwnershipDocuments.


314 Add a Class action - ProduceDocument , give the ExecuteExpression the value of self.opendocumentreportshow(CarTransferOwnershipDocument.ViewModels.TheTemplateForCarTransferOwnershipDocumentReport) - expect the error due to not having the TheTemplateForCarTransferOwnershipDocumentReport viewmodel yet
314. Add a Class action: ProduceDocument, and give the ExecuteExpression the value of self.opendocumentreportshow(CarTransferOwnershipDocument.ViewModels.TheTemplateForCarTransferOwnershipDocumentReport). Expect the error due to not having the TheTemplateForCarTransferOwnershipDocumentReport ViewModel yet.


315 Create a TheTemplateForCarTransferOwnershipDocumentReport viewmodel, set class to CarTransferOwnershipDocument, check the Requiers Root box
315. Create a TheTemplateForCarTransferOwnershipDocumentReport ViewModel. Set the class to CarTransferOwnershipDocument and check the Requires Root box.


316 Right click menu in the ViewModel tree - Add columns needed for report, expect the TemplateUrl and ReportFileName viewmodelcolumns
316. Right-click the menu in the ViewModel tree. Add the columns needed for a report. Expect the TemplateUrl and ReportFileName ViewModelColumns.


317 Verify that the action that was faulty before now finds the TheTemplateForCarTransferOwnershipDocumentReport
317. Verify that the action that was faulty before now finds the TheTemplateForCarTransferOwnershipDocumentReport.


318 In the TheTemplateForCarTransferOwnershipDocumentReport - viewmodel - click out the UsePlacingHints to hide the UI part of the ViewModel
318. In the TheTemplateForCarTransferOwnershipDocumentReport ViewModel, click on the UsePlacingHints to hide the UI part of the ViewModel.


319 In the FileMenu ShowCurrentModelDirectory, check the model file name - "Start.modlr" , create a folder Start_AssetsTK - read about on AssetsTK on the wiki
319. In the FileMenu ShowCurrentModelDirectory, check the model file name: "Start.modlr". Create a folder named Start_AssetsTK and read about AssetsTK on the Wiki.


320 Create a folder Content in Start_AssetsTK, start word , new document , write "this will be my template" save as ODT format in Start_AssetsTK/Content - call the file ThisWillBeMyTemplate.odt
320. Create a folder - Content in Start_AssetsTK. Start Word, click on a new document, and write: "this will be my template." Save as ODT format in Start_AssetsTK/Content and call the file: ThisWillBeMyTemplate.odt


321 Close word - in order to avoid file loch while MDrivenDesigner tries to access it
321. Close Word in order to avoid file lock while MDrivenDesigner tries to access it.


322 check that your appurl starting with <nowiki>http://localhost</nowiki>:...  , test <nowiki>http://localhost</nowiki>:<port>/content/ThisWillBeMyTemplate.odt - ensure that you can access the template (you must use the port number you use)
322. Check that your app URL is starting with <nowiki>http://localhost</nowiki>:... Test <nowiki>http://localhost</nowiki>:<port>/content/ThisWillBeMyTemplate.odt - Ensure that you can access the template (you must use the port number you use).


323 In ViewModel for the template in the TemplateUrl set the string value '<nowiki>http://localhost</nowiki>:<port>/content/ThisWillBeMyTemplate.odt'
323. In the ViewModel for the template, in the Template URL, set the string value '<nowiki>http://localhost</nowiki>:<port>/content/ThisWillBeMyTemplate.odt'


324 Set the ReportFileName expression to 'TheSalesReportForCar'+self.Car.RegistrationNumber+'.odt'
324. Set the ReportFileName expression to 'TheSalesReportForCar'+self.Car.RegistrationNumber+'.odt'


325 Test the ProduceDocument action - ensure that you get a document - with name from the registration number
325. Test the ProduceDocument action and ensure that you get a document with the name from the registration number.


326 In the template odt add %meta% - save and close - resave the model to upload - Test the ProduceDocument again - verify you see the expanded proprties from the %meta% tag
326. In the template odt, add %meta%. Save and close. Resave the model to upload. Test the ProduceDocument again and verify that you can see the expanded properties from the %meta% tag.


327 Head back to viewmodel for template and add Buyer, Seller,RegistrationNumber and Brand (self.Car.Brand.Name)
327. Head back to the ViewModel for template and add Buyer, Seller, RegistrationNumber, and Brand (self.Car.Brand.Name).


328 Test the ProduceDocument action again - copy the expanded viewmodel data names from the document - paste those into the original document - this will be expanded to data
328. Test the ProduceDocument action again. Copy the expanded ViewModel data names from the document and paste them into the original document. This will be expanded into the data.


329 Write a text in the template and mix in the tags: The buyer named %Buyer% has purchased the car %RegistrationNumber% of type %Brand% from %Seller%
329. Write a text in the template and mix in the tags: The buyer named %Buyer% has purchased the car %RegistrationNumber% of type %Brand% from %Seller%


330 Turn off spellcheck in document so that tags does not distorted in the resulting file, save , close word , save model
330. Turn off spellcheck in the document so that the tags are not distorted in the resulting file. Save and close Word. Save the model.


331 Test the ProduceDocument action again - ensure you get a document with tags expanded to data according to the definition in your template viewmodel
331. Test the ProduceDocument action again. Ensure you get a document with tags expanded to data according to the definition in your template ViewModel.


Next chapter: [[The_1000_steps_program_to_MDriven_Chapter_11]]
'''Next Chapter:'''
 
[[The_1000_steps_program_to_MDriven_Chapter_11]]


[[File:ModelAfterChapter10.zip||ModelAfterChapter10 as zip]]
[[File:ModelAfterChapter10.zip||ModelAfterChapter10 as zip]]
[[Category:1000 Steps Program]]
[[Category:1000 Steps Program]]

Revision as of 07:00, 23 January 2023

This is Chapter 10. If you want to start from the beginning, you can start here; see also: Chapter 9 (the previous chapter).

Here is the Chapter 10 video: https://youtu.be/2K5YHBVyhyA

Video 10: MDrivenEducationVideo Chapter 10: Creating a Report

Title Content Time(segment start) Youtube Link
Introduction Introduction 00:00
Fixing errors Handling errors, locating them, and fixing them 00:06
LinkRoleName Link classes, changing LinkRoleName, and fixing the errors the change creates. 05:52
New ViewModel Creating a new ViewModel 16:22
Creating a report Creating a report; creating the template URL 23:07
Adding data Creating a report and adding data to the report document 34:13

Correcting Errors (if you have them), Setting LinkRole Names on Association Classes, and Creating Open-document Reports

302. Create some intentional errors, for example, by renaming the CartransferOwnershipDocuments to CartransferOwnershipDocument. Save and practice following the error leads from the red dots, and fix the error.

303. Create some intentional errors, for example, by changing the expression of a class action on Car. Save and practice finding the error from the red dots. Fix the errors, save, and ensure you have a clean model with no errors.

304. Find the link class HistoricOwnership. Select the association and change from <Default> to HistoricOwnerships (with a plural s) in the LinkRoleName on both Association ends for the associations. Save and check for errors.

305. Fix the errors by clicking on them and updating the expressions to reflect the new name HistoricOwnership -> HistoricOwnerships.

306. Drop the ShowCar action that does not have a ViewModel to show.

307. Create a New ViewModel called ProperCarView. Set the Class to Car, Set Requires Root.

308. Add a Class Action to bring the ProperCarView up.

309. Show the RegistrationNumber in the PropertCarView by adding a column.

310. Also, add the State, BrandOfCar, and CarOwner - make them static to avoid editing.

311. Add the multilink for CarTranserOwnershipDocuments as a grid.

312. Add columns in this grid, Seller, Buyer, and remove the AsString default column.

313. Start the web prototype. Search cars and open the PropertCarView on a Car that has CarTranserOwnershipDocuments.

314. Add a Class action: ProduceDocument, and give the ExecuteExpression the value of self.opendocumentreportshow(CarTransferOwnershipDocument.ViewModels.TheTemplateForCarTransferOwnershipDocumentReport). Expect the error due to not having the TheTemplateForCarTransferOwnershipDocumentReport ViewModel yet.

315. Create a TheTemplateForCarTransferOwnershipDocumentReport ViewModel. Set the class to CarTransferOwnershipDocument and check the Requires Root box.

316. Right-click the menu in the ViewModel tree. Add the columns needed for a report. Expect the TemplateUrl and ReportFileName ViewModelColumns.

317. Verify that the action that was faulty before now finds the TheTemplateForCarTransferOwnershipDocumentReport.

318. In the TheTemplateForCarTransferOwnershipDocumentReport ViewModel, click on the UsePlacingHints to hide the UI part of the ViewModel.

319. In the FileMenu ShowCurrentModelDirectory, check the model file name: "Start.modlr". Create a folder named Start_AssetsTK and read about AssetsTK on the Wiki.

320. Create a folder - Content in Start_AssetsTK. Start Word, click on a new document, and write: "this will be my template." Save as ODT format in Start_AssetsTK/Content and call the file: ThisWillBeMyTemplate.odt

321. Close Word in order to avoid file lock while MDrivenDesigner tries to access it.

322. Check that your app URL is starting with http://localhost:... Test http://localhost:<port>/content/ThisWillBeMyTemplate.odt - Ensure that you can access the template (you must use the port number you use).

323. In the ViewModel for the template, in the Template URL, set the string value 'http://localhost:<port>/content/ThisWillBeMyTemplate.odt'

324. Set the ReportFileName expression to 'TheSalesReportForCar'+self.Car.RegistrationNumber+'.odt'

325. Test the ProduceDocument action and ensure that you get a document with the name from the registration number.

326. In the template odt, add %meta%. Save and close. Resave the model to upload. Test the ProduceDocument again and verify that you can see the expanded properties from the %meta% tag.

327. Head back to the ViewModel for template and add Buyer, Seller, RegistrationNumber, and Brand (self.Car.Brand.Name).

328. Test the ProduceDocument action again. Copy the expanded ViewModel data names from the document and paste them into the original document. This will be expanded into the data.

329. Write a text in the template and mix in the tags: The buyer named %Buyer% has purchased the car %RegistrationNumber% of type %Brand% from %Seller%

330. Turn off spellcheck in the document so that the tags are not distorted in the resulting file. Save and close Word. Save the model.

331. Test the ProduceDocument action again. Ensure you get a document with tags expanded to data according to the definition in your template ViewModel.

Next Chapter:

The_1000_steps_program_to_MDriven_Chapter_11

File:ModelAfterChapter10.zip

This page was edited 33 days ago on 04/12/2024. What links here