Welcome! Log In Create A New Profile

Advanced

What other developers mean

Posted by ICI 
ICI
What other developers mean
September 26, 2008 10:07PM
Regards to all.

I have few things I think about it and I need your opinion .
I have project with analysis in which will be integrated all data files (tables),
related and so on, needed to implement many aspects of business.

I want to implement possibility for users to have many business years
in one project and to simply jump into year (ex. from 2008 to 2007)
and print some invoice or similar.

In my Xbase++ project I'm implement this trough different directories
and when user in TableBrowse click on "Year 2007" program change default
directory to data and automaticaly open these tables, but this is easy 'couse
my Xbase++ project uses dbf's tables and have no analysis.

Are you uses HFilter() to filter data into tables and keep all years into one analysis
or you have fresh empty copy of the analysis and keep different years into different
analysis, and then change connection to that analysis.

I hope you understand what I'm mean and I hope this is not confused question smiling smiley

Al
Re: What other developers mean
September 27, 2008 04:39AM
Hello ICI

We maintain the data for all years in the same set of files, not in separate sets per year as you currently do.
Our program allows clients 3 years of financial reporting and unlimited years for all data in a more general sense.
We do this with two fields in each file
YearEndFlag 2 chr string
YearEndnumber Numeric

In the current year both fields are blank
When the prorgam closed "last" year on 30th June 2008 all the data with blank year info was set to
YearEndFlag "L08" (L)ast year
YearEndNumber "2008"

The previous year data was
YearEndFlag "L07"
YearEndData "2007"
The YearEndFlag on that data became "P07" (P)revious year
The YearEndFlag "P06" became "X06"

All years prior to that already had an "X" prefix. e(X)pired data

Using this method I can quickly get current year data as
YearEndFlag = ""
I can get last year's data as:
YearEndFlag [= "L"
I can get the previous years data as
YearEndFlag [= "P"

The reason for the two sets of flags is that it gives me a backup set of inidicators if one is corrupted and two different ways of classifying the data. Another is that I can get current year, last year or previous year data without having to know what year number I am processing. The numeric year value is handy on the odd occasion we have to get a specific years data and the other flag has already been set to an "X" prefix

We only need to define three years for financial data because that is all our clients ask for in terms of their General Ledger. In our jobs and creditor/debtor files the data goes back forever and is easily grouped using the numeric YearEndNumber.


Regards
Al


ICI
Re: What other developers mean
September 27, 2008 08:27PM
AI, thank you for your answer. I think this is very good solve you are do.

I have another question.

If you do this, you always filter all three years in a table(s) and display current year.
You filter this by query or with HFilter(). I have no much experience with WinDev
in network - client/server mode and filtering. How it is fast in network environment.

You have composite key on this fields, and very fast you can HreadSeek() and point
to first row of needed year, then you use probably HFilter().

Please, Explain me this situation. Thank you again.

Best Regards !


Al
Re: What other developers mean
September 28, 2008 04:11AM
Hello ICI

Let me start by saying that the way we do things is probably not the optimum, because I have never used queries. When I started with Windev the queries were dreadfully slow and there was only Hyperfile and we now have huge slabs of working code and to date we have not seen the need yet to change to queries and the Windev C/S.

We extract data from Hyper files on the server using Hfilter(), or Views. We find that views are very quick. On our larger sites our clients use terminal server and this gives very good speed so there is no pressing need for us to change our methods. We generally put the data into memory tables, because up until version 12 there was no way to use file tables and sort by columns without an underlying index.

In terms of the method we use to extract data by the year we only have an index on the YearEndFlag. Most times the data is being extracted on another key, account number or job or customer etc and the year info is used as part of a condition rather than as a key. There are too many combinations possible to use it as a composite key although it would give better results if we did create some for the most used cases.

This is a small sample of extracting data using the year end flags

<pcode>
PRTransView is a Data Source
HDeactivateFilter("PRTRANS")
LViewFlds is string = "PTCLEUNIK,ActualCost,TransactionDate,TransactionType,TransactionReference,Quantity,AllowanceQuantity,ActualRate,EMCLEUNIK,TACLEUNIK,BHCLEUNIK,EPCLEUNIK,JOCLEUNIK,EDCLEUNIK,EECLEUNIK,PYCLEUNIK,SourceFile,EACLEUNIK,EUCLEUNIK,DrGlAccount,CrGlAccount,CarryFowardRecord,PGCleunik,JCJournal,PrJournal"
LViewSort is string = "PTCLEUNIK"
SWITCH LTransDisplay
CASE "ALL"
SWITCH LYearFlag
CASE "C" //current
HCreateView(PRTransView, Prtrans, LViewFlds,LViewSort, "EMCLEUNIK="+Emp.EMCLEUNIK+" AND YearFlag]='"+" "+"' AND PRJournal=1", hViewDefault)
CASE "L" //last Year
HCreateView(PRTransView, Prtrans, LViewFlds, LViewSort, "EMCLEUNIK="+Emp.EMCLEUNIK+" AND YearFlag]='"+"L"+"' AND PRJournal=1",hViewDefault)
CASE "P" //previous year
HCreateView(PRTransView, Prtrans, LViewFlds,LViewSort, "EMCLEUNIK="+Emp.EMCLEUNIK+" AND YearFlag]='"+"P"+"' AND PRJournal=1",hViewDefault)
OTHER CASE //all years
//leave out the carry forward journals
HCreateView(PRTransView, Prtrans, LViewFlds,LViewSort, "EMCLEUNIK="+Emp.EMCLEUNIK+" AND PRJournal=1 and CarryFowardRecord = 0", hViewDefault)
END

Case....
End
</pcode>

When you are coding Hfilter() and HCreateView() I always use the wizard to write the code as even after all these years I still don't trust myself to get all the combinations of double and single quote delimters exactly correct.

Regards
Al



Edited 1 time(s). Last edit at 09/28/2008 04:16AM by Al.
Stefan Bentvelsen
Re: What other developers mean
September 28, 2008 07:30PM
Hi ICI,

we use different directories for each administration or (in your case) for each year.
To change the administration, we close all files (HClose("*")) and use HChangeDir() to change the directory of the files. We use one analysis for this. There's no need for more than one.

If you want to have the year in the filename, you can use HChangeName() too.

ICI
Re: What other developers mean
September 28, 2008 10:16PM
Mr. Stefan

Do you mean you use same analysis cloned in different directory's.
You have somewhere on the disk empty analysis and when user open new year
you copy all files from that directory into directory for new created year.

Or you just copy empty .FIC files with same structure into newly opened year.
And than just re-route path for FIC files into analysis.

My old project have this directory structure:

Aplication
. . . . . . . . |__C001
. . . . . . . . . . |__Y2006
. . . . . . . . . . |__Y2007
. . . . . . . . . . |__Y2008
. . . . . . . . |__C002
. . . . . . . . . . |__Y2008

"C" is Company + ID
"Y" is Year, directory for actual data for that year
And I use similar situation like you.
When user choose some year, I change path for data files and on next open
I have situation : cPathData + cYear + Table

Please, comment more this situation.

Regards !
Stefan Bentvelsen
Re: What other developers mean
September 28, 2008 10:37PM
Quote
ICI
Mr. Stefan

Do you mean you use same analysis cloned in different directory's.
You have somewhere on the disk empty analysis and when user open new year
you copy all files from that directory into directory for new created year.

Or you just copy empty .FIC files with same structure into newly opened year.
And than just re-route path for FIC files into analysis.

My old project have this directory structure:

Aplication
. . . . . . . . |__C001
. . . . . . . . . . |__Y2006
. . . . . . . . . . |__Y2007
. . . . . . . . . . |__Y2008
. . . . . . . . |__C002
. . . . . . . . . . |__Y2008

"C" is Company + ID
"Y" is Year, directory for actual data for that year
And I use similar situation like you.
When user choose some year, I change path for data files and on next open
I have situation : cPathData + cYear + Table

Please, comment more this situation.

Regards !

Yes ICI,

we use for each administration a set of files in an own directory. Beside that, we use a number of files in one directory that we use for each administration. Kind of general files, i.e. users, administrations, users per administration, etc.

In fact there is only one analysis that contains the definition of the files. There's no need to 'clone' this analysis. At runtime you decide which files will be used (in which directory) with HChangeDir() and eventually HChangeName(). We use the structure:

Application
...|__data
........|__C001
........|__C002
........|__C003
........|__ ...
........|__C00n

We also have clients that uses HyperFile Client/Server. In that case we use one database with the general files in the 'root' (.\) and per administration a subdirectory (.\C001\, .\C002\, etc.)

If we want to start a new administration (in your case maybe a new year) we can copy the files from one directory to the new one, but only if we want to use (partly) the same data. For starting an 'empty' administration, after creating the directory, you can use HCreationIfNotFound() after HchangeDir() and HChangeName(). The files will be created in the new directory.
ICI
Re: What other developers mean
September 28, 2008 11:09PM
Stefan , Thank you !

I was always use this way like you and it is very close to me.
Now, when I try to implement same with WinDev I was trapped with the Analysis
and way Analysis work.

I'm happy because I can do same things with WinDev.
Thank you for the time you spend to explain to me this situation.

Best regards !
ICI
Re: What other developers mean
September 28, 2008 11:47PM
Regards !

I'm try to create some views and this work normally, but,
If I'm understand you use Views to create new FIC file on the server when user request this
and then you have already filtered data and then just display that file
in the Window or where?

I'm not sure how. Is there any problem with Analysis if file change structure.
Maybe, I do not understand your situation because I was not use early versions of WinDev.

In all cases, thank you for your very detailed answers.

Best wishes !
Al
Re: What other developers mean
September 29, 2008 01:18AM
Hello ICI

From the HCreateView() help:
Reminder: A Hyper File view is a "memory image" of all or a part of a data file. A view is stored in memory, which insulates it from modifications made to the linked file. Once created, a view is managed the same way as a Hyper File data file.

You can read through the view as if it was a file using H commands or you can put it in a memory table with a matching structure using FileToMEmoryTable()

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: