Report in LiveCode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
cbarbal
Posts: 114
Joined: Fri May 08, 2015 5:04 pm

Report in LiveCode

Post by cbarbal » Sat Dec 15, 2018 11:22 am

Hi all,

How can I play this FileMaker report in Livecode?

The report looks for the expenses of a property between two dates and puts the detail of each expense. When the expenses of a property end. puts the totals of the expenses and taxes and starts a new sheet with the following property.

A property can have one or more sheets of paper. At the end of the report it puts the sum of the totals of all the properties.

To make the FileMaker printing template clearer, I added it.
FileMaker Pro Advanced002.jpg
Thanks in advance,

Carles

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6467
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Report in LiveCode

Post by dunbarx » Sun Dec 16, 2018 12:18 am

How can I play this FileMaker report in Livecode?
Do I read that as "How do I get FileMaker data into LiveCode, so I can process it"?

I am not a Filemaker user, so I do not know if Filemaker can export a page of data as a text file, or perhaps save a page of data as an excel file. If it can do something like that, then the procedure will be simple and straightforward. We simply need to parse the data according to your needs, and work it from there.

But what about those first few questions? Anyone?

Craig Newman

Klaus
Posts: 11495
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Report in LiveCode

Post by Klaus » Sun Dec 16, 2018 1:18 am

Hi Craig,
dunbarx wrote:
Sun Dec 16, 2018 12:18 am
How can I play this FileMaker report in Livecode?
Do I read that as "How do I get FileMaker data into LiveCode, so I can process it"?
...
no, that is just an example FM report layout that Carles would like to re-create in LC.
The data are coming from a SQLite database.

Best

Klaus

cbarbal
Posts: 114
Joined: Fri May 08, 2015 5:04 pm

Re: Report in LiveCode

Post by cbarbal » Sun Dec 16, 2018 12:16 pm

Hi Craig,

The types that can be exported and imported are: csv, dbf, fmp12, htm (export only), mer, xlsx, tab or txt, xml. But as Klaus says this is not the issue.

What I try to find out if I can leave FileMaker and replace it with LiveCode, which I start to doubt. But I need everything I do with FileMaker to do with LiveCode, even if it's more complex to do. That it is, although it also has its advantages :D

The normal reports type list, I can reproduce them with LC. But I'm interested in the complexes that I do with FM. Klaus has seen the original impression of this report and already knows what we are talking about. If you want, I can send it to you to get an idea and assess if it is feasible to do it with LC. I hope Google's translation is similar to what I mean

Regards,

Carles

cbarbal
Posts: 114
Joined: Fri May 08, 2015 5:04 pm

Re: Report in LiveCode

Post by cbarbal » Sun Dec 16, 2018 12:36 pm

Hi,

I have noticed that the initial template that I have put is not what corresponds to the description of the first post. I use both of them but this one is a bit more complex
FileMaker Pro Advanced001.jpg
Sorry,

Carles

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6467
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Report in LiveCode

Post by dunbarx » Sun Dec 16, 2018 5:19 pm

Hmmm.

It seems to me that it would take about half an hour to re-create that form, and just a few seconds from then on to populate it from any sort of query.

Whether or not it is worth doing so is up to charbal, but I bet that LC can do far more with the data than Filemaker can, and be more fun in the process.

Klaus, do you agree that Filemaker may have better tools to do what charbal wants? As I mentioned, I have never used it.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Report in LiveCode

Post by jacque » Sun Dec 16, 2018 6:44 pm

I talked about this in your other thread: https://forums.livecode.com/viewtopic.p ... 15#p174267
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7299
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Report in LiveCode

Post by FourthWorld » Sun Dec 16, 2018 8:00 pm

The trick here is that his report has summaries and sub-summaries. FMP's reporting is quite excellent. This is all doable in LC, but would have to be scripted; in FMP it's right there in the box, and the work to recreate it is non-trivial.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Report in LiveCode

Post by jacque » Sun Dec 16, 2018 8:10 pm

FourthWorld wrote:
Sun Dec 16, 2018 8:00 pm
The trick here is that his report has summaries and sub-summaries. FMP's reporting is quite excellent. This is all doable in LC, but would have to be scripted; in FMP it's right there in the box, and the work to recreate it is non-trivial.
It's just a matter of calculating sums from the page data before filling in the field and would be part of the handler that fills the rest of the fields. It wouldn't be too big a challenge and is one of those details I mentioned the OP may need help with. I did this sort of thing with functions way back in HyperCard.

Yes, all reports have to be scripted. I agree it isn't as automatic as FM but it also isn't very hard to add a simple sum command to a handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7299
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Report in LiveCode

Post by FourthWorld » Sun Dec 16, 2018 8:35 pm

It's more than just adding numbers. Some sections get repeated, with sums below those, and then a master total at the end. This means creating groups elsewhere, copying them in as needed, diligently positioning them, populating them with data, and then doing the arithmetic.

Doable in LC, but it's several hours' work compared to the few minutes it would take to generate that report in FMP.

I'm not dissing LC here. It's a general-purpose toolkit that does things FMP can't dream of. One could even make FMP in LC, and to try to go the other way would be impossible.

But as a purpose-built DB tool, FMP holds some strong productivity advantages for specifics types of DB-specific work, such as multi-part reports like this one.

I've been tempted to build a reporting tool, but as I talk with devs it seems they all handle their data in such different ways that just the bindings part would be quite a time sink. But if anyone wants to pay my bills for a couple months I could turn out a nice one. :)
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

golife
Posts: 27
Joined: Fri Apr 02, 2010 12:10 pm

Re: Report in LiveCode

Post by golife » Mon Dec 17, 2018 6:01 pm

Well, I am quite experienced with FileMaker and I also liked the reporting tool. I had built myself a similar report generator, not finished enough to publish, but maybe...

Let me explain a bit the logic I see in creating a reporting tool that is fully based on LiveCode script.

The principle is very similar to Filemaker. There is a separate template page (LiveCode card) with a header section, a footer section and a detail section where the report layout is defined. Even, I have a section for one-page prints or many pages, a title page, a trailing page with a trailing summary and report end. There are objects that appear on each page such as page numbers or running totals and shared headers and footers.

How abstract such template page would depend on the level of user-friendliness you want to give to the user. You could have him size the various sections and create objects there just as in Filemaker, size them, style them, and whatever. The user could then save such template for future reports. What a user could not easily do is bind fields to a data source. This needs more scripting and is not automatic (or could be made automatic eventually if such functionality would also be scripted).

The detail section (as all the other sections) on the template page is a group of controls, such as fields, images, etc. that are used to later recreated them in the report and fill them with data received from any data source, database, or even just single entries by the user. So, those fields and other controls are then bound to the data source.

Now, when the report is running, you have to script the number of details as well as header and footer sections that fit on the first page and all following pages depending on the size of the paper (here it is mainly A4). You also have to script when there is a page break and where you want this page break to occur. It is a bit more complicated when the page break would happen inside of a record as in my case, a record may have a lengthy report field (for example a long list of product details) and the height of such field varies. If this can be avoided, it is not that difficult.

You can also script a running total, a page total (I could not do this in Filemaker) and I could even accommodate different areas where the report would place product photos and size them automatically.

The great news here is that you could first create "pages" using the card metaphor and simply print everything inside LiveCode on cards with the size of your paper. You would have a virtual report that you can still adjust (for example have manually adjusted page breaks) and a correct page numbering.

This is not as easily possible in Filemaker as you do not really know how the printed report will look like depending on the output media, printer, etc. The "preview" in Filemaker does not tell the real situation. In LiveCode, you really know how each page will look like.

The limit here is the limit of cards or the limit of handling that many cards, maybe 1000 cards/pages. For lengthy reports, I would just print them without first rendering them as pages in LiveCode, just creating each page in memory, placing it on a separate "report" card, and then printing the card.

LiveCode is a fantastic tool that really allows you creating a reporting "engine" -- even much better than in Filemaker I believe--, but for whatever reason, since Quartam went silent, there has never been a genuine and multi-purpose reporting tool. (There are reporting tools on the database side that can be used, or data is exported from LiveCode to other reporting tools). But all that is not within the LiveCode ecosphere.

So, actually, there is nothing in the reporting engine of Filemaker that could not be done in LiveCode with the exception, that fields in LiveCode are not database fields by themselves, but have to be programmed to receive data.

In a sense, such reporting tool bears some similarities with the DG (data grid) in LiveCode. It would not keep the records in the boundaries of a grid but spread them out to LiveCode cards (pages) or at least onto one page that will be rebuilt for each set of records fitting in.

Also, it is possible to define groups of records and grouping them with title, subtitle and sub summary sections. It just requires more scripting. Only, we have here the freedom to chose how such groups and subgroups are handled and on which sets of data they are defined in an SQL database or whatever other data source. This is not that easy, but also doable.

All this can be as simple or complex as you want. Some medium level scripting experience is required though. I am not the master of LiveCode scripting.

It is just a time constraint that I was not able to share at least the basics of such engine. I think it would be worthwhile creating such a tool for multi-purpose printing.

---

So, the main principle is to define a "record" of data containers (fields, images, graphics) and group it. Then copy that template group to the page in the order you want and the way you want the records to appear. Then use the template group to copy it one below the other in the given order and fill the containers (fields, etc.) inside each newly created group with the data. Then you print it. Afterwards, you can delete all the records and recreate them again.

You can really create any type of report you want and print it as PDF or on any printer.

---

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Report in LiveCode

Post by jacque » Mon Dec 17, 2018 6:06 pm

It's more than just adding numbers. Some sections get repeated, with sums below those, and then a master total at the end. This means creating groups elsewhere, copying them in as needed, diligently positioning them, populating them with data, and then doing the arithmetic.
Nah, the hide/show method discussed in the other thread might do. Or better, just have different templates for each type of report where no placement or object creation is necessary.

I've done more of this kind of thing than I care to remember. It can be tedious but it isn't hard.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7299
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Report in LiveCode

Post by FourthWorld » Mon Dec 17, 2018 9:13 pm

jacque wrote:
Mon Dec 17, 2018 6:06 pm
It's more than just adding numbers. Some sections get repeated, with sums below those, and then a master total at the end. This means creating groups elsewhere, copying them in as needed, diligently positioning them, populating them with data, and then doing the arithmetic.
Nah, the hide/show method discussed in the other thread might do.
I missed that one. Where can I find it?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

cbarbal
Posts: 114
Joined: Fri May 08, 2015 5:04 pm

Re: Report in LiveCode

Post by cbarbal » Tue Dec 18, 2018 11:50 am

Hi Richard,

I guess jacque refers to this post

https://forums.livecode.com/viewtopic.p ... 8&start=15

In principle, the beginning of the post was another topic and it gets a bit confusing if you look for print report.

Now I am in the testing phase with hide and show part of the groups. There are 4 records per page, 4 individual groups for the records, 4 for the sub-summaries and 4 for the grand total. I think I'm on the right track

Regards,

Carles

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7299
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Report in LiveCode

Post by FourthWorld » Tue Dec 18, 2018 5:09 pm

Yes, when you have a fixed number of elements becomes much less daunting. It's when you have to dynamically place N number of elements, with N number of subsummaries, that the generalization required becomes time consuming.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”