Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something like !==
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00811797
Message ID:
00811821
Views:
11
Hello,

If my hunch is correct, then you are dealing with an accounting plan. This can be handled wery well with a hierarchical table structure, something like that:

cod_cuenta C(20)
nombre_cuenta C(50)
parent_cuenta C(20)

where parent_cuenta contains the cod_cuenta of the parent record. In your case, the table will look like this:
cod_cuenta      nombre_cuenta                 parent_cuenta
1               ACTIVOS                       .NULL.
10              ACTIVOS CORRIENTES            1
11              OTROS ACTIVOS                 1
2               PASIVO                        .NULL.
3               CAPITAL                       .NULL.
This approach will allow the use to add another subordinate record (I'll give you the romanian expresion for it - you'll understand: "Cont analitic") to any existing record. For example:
cod_cuenta      nombre_cuenta                parent_cuenta
1               ACTIVOS                      .NULL.
10              ACTIVOS CORRIENTES           1
101             Activos corrientes 2002      10
102             Activos corrientes 2003      10
11              OTROS ACTIVOS                1
111             Otros Activos 2002           11
112             Otros Activos 2003           11
2               PASIVO                       .NULL.
3               CAPITAL                      .NULL.
And so on.

To extract all the records you need (I am assuming you need the subordinate records of a specific record, to calculate the monthly balance sheet), you have to recursively scan the table. When you'll write the recursive code, you'll see it's piece of cake, once you've done it. Basically, you have to use the same method/procedure for every record and scan table for records having parent_cuente = searched_record.cod_cuente.

If you need further information on this subject, please let me know.


Hope this helps.



>>
>>>I have a table with this records:
>>>cod_cuenta (c(20))         Nombre_cuenta (c(50))
>>>1                            ACTIVOS
>>>10                           ACTIVOS CORRIENTES
>>>11                           OTROS ACTIVOS
>>>2                            PASIVO
>>>3                            CAPITAL
>>
>
>>>IF i make a select like this:
>>>SELECT * FROM catalogo WHERE alltrim(cod_cuenta) <> "1"
>>>Ignore all records that begin with "1", is there a way to ignore only record where cod_cuenta = "1". I want to make a exact search like when using ==.
Grigore Dolghin
Class Software.
Previous
Reply
Map
View

Click here to load this message in the networking platform