Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need advice in design
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00348171
Message ID:
00348983
Views:
23
Nadya:
I once had a problem like this. Many structures that required calculations. The permutations of these structures seemed to require an endless list of functions to service each structure's calculations.

What I did (don't know if its possible in your case) was to generalize the I/O for each structure into one procedure. Categorize the base types for each structure, and then pass parameters (general to all structures) to one procedure.

Something to think about:
MyCalcFieldOrVariable="arg1 * arg2 + (arg3/arg4)"
Then, depending to the category of each structure, go off and calculate arg1,arg2,arg3 and arg4
... then
ThisOutPut=&MyCalcFieldOrVariable

Maybe, regarding your I/O requirements as a generalized concept (like an object or collection), rather than a discrete set associated with specific items would help simplify the solution.

A Conceptual Lookie Here:
VolumnTriangleCalculation ="W * H * 1/2"
VolumnRectangleCalculation ="W * H"
w=some number
h=some number
VolumnCalculation=iif(MyObject="RECTANGLE","VolumnRectangleCalculation","VolumnTriangleCalculation")
TheVolumn=&VolumnCalculation

This is over simplified, and may not apply in your case, but saved me a lot code

>Hi Ed,
>
>Thanks a lot for your response. The problem is, that all these procedures are already in the big procedure file. Some of these procedures are only few lines of code. Right now there is an existing table with TownName ProcedureName, e.g. each town has it's own method to calculate APN (could be the same for several different towns). So, it's really almost impossible to have duplicates of Procedure name. And, besides, I can check for duplicates before save into file.
>We have ~300 towns in MA + ~200 in CT (right?), don't remember how many in RI. It's may be worthless to keep each algorithm in separate file.
>
>Anyway, I really appreciate your suggestion and will think more...
>
>Thanks.
>
>
>>>Barbara,
>>>
>>>Honestly, I'm just preparing for the future application, so I haven't designed yet :) Today I tried Vlad's suggestion, it works, but I think, I better would use Edit box instead of MODI COMM.
>>>As far as I understand, I should do the following:
>>>1) editbox.value=filetostr('MyProcedure.prg')
>>>2) lnPos=atc('MyFunction',editbox.value)
>>>3) Scroll to this position - How can I do? Something with SelStart, but don't know exactly, how
>>>4) Edit the code
>>>only if code was modified (check this)
>>> 5) strtofile(alltrim(editbox.value),'MyProcedure.prg') ??? -
>>> 6) compile myProcedure
>>>
>>>
>>>This is the algorithm, which I have in mind. What do you think? I'm not also know exactly about third step, could you help, please?
>>>
>>
>>Abandon the idea; if you really need discrete editable procedures, make them separate files so that you don't accidentally duplicate a function name in the file or risk every piece of code every time you edit a procedure. This is an incredibly poor approach to managing code.
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform