Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tricky problem
Message
 
 
À
22/03/2002 04:21:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00635856
Message ID:
00635997
Vues:
18
>>Hi everybody,
>>
>>We have the following tables:
>>
>>Methods:
>>MethodID MethodCode
>>
>>Messages
>>MessageID MethodID Message Severity
>>
>>ValCalls
>>ValCallID Table      Field    CallProc                  ShowFields           BldMStr(L) BldMstrP(L)
>>1         PropMstr            ProMstrTr(field1,field2)  Field1,Field2,Field3
>>2                     Owner1  Name(Owner1)              Field1,Field2
>>
>>
>>These are methods for table rule and fields rule. And here is the problem:
>>The same method could be run for the same table, but with the different combination of fields, and of course, different combination of Show Fields.
>>
>>So, the question is:
>>How can we identify, which particular ShowFields are associated with each error?
>>
>>The typical method's code looks like:
>
>Nadya,
>
>Am I correct in that the pcFieldName is a ShowField ?
>ie you are passing the FieldName to your check routine
>
>
>>lparameter pcValue, pcFieldName (or combination of fields)
>>if some error condition
>>   return EvalCode(MessageID, pcFieldName)
>>endif
>>
>>return .t.
>>
>>Can you please help me with ideas of solution for this problem...
>>
>>Thanks a lot in advance.

Hi Gregory,

In case of field level validations, there is no ambiguity, but in case of table level validation we can call the same method with different parameters, e.g. for TranMstr:
NameRel(BUYER1,BUYER2,BUYERREL,"table")
NameRel(SELLER1,SELLER2,SELLERREL,"table")

So, in this case we don't know, how to correctly identify, which record in VallCalls we would need to use in Resolve form to find the Show Fields (these are the fields, which are shown for the user to review and correct the problem).

You see the problem now?

Here are my ideas (thought about it at night):

1) Include ValCallsID (or some other unique identifier) in the call of the method - this is obviously the most complicated solution, because it requires lots of changes in the existing code

1a) Introduce new property of oValid object to hold this "ValCalls" unique identifier and assign it before each call of Table level validations - this is a little bit simpler to implement, than 1, but still requires lots of changes.

2) In the routine, which finds ShowFields, find all records, which are relevant for the given method + given table and combine all fields together, e.g. in the above example show Buyer1, Buyer2, BuyerRel, Seller1,... etc.

3) Put this combination of fields in ValCalls table itself, e.g. each call would have all list of fields (even if they are not relevant for this particular call).

What do you think?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform