Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number of combination problem
Message
From
02/09/1999 18:58:52
 
 
To
02/09/1999 15:23:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00260337
Message ID:
00260902
Views:
23
Brian-

Raw suggestions (assuming the forms table is called forms.dbf):
CREATE SQL VIEW vwFormAlinks AS SELECT forms.* FROM forms WHERE start_field = ?lcFormName 

CREATE SQL VIEW vwPaths AS SELECT forms.* FROM forms WHERE start_field = ?vwFormAlinks.end_field

*!* PROGRAM
GLOBAL glTarget && This is not an endorsement of global variables by the way < bg>...it's just an expedient.  How you do this will depend a bit on your goals.

glTarget = 'FormG' && or whatever

USE vwPaths IN 0 NODATA
USE vwFormAlinks IN 0 NODATA

IF TransversePath( 'FormA' ) && The name of the top level form
  *!* We found a valid path to the target from every path that branches from this form.
ELSE
  *!* We had an unsuccessful path.  What do we do with this info? < s>
ENDIF

FUNCTION TransversePath
LPARAMETER tcFormName
LOCAL lcFormName, llSuccess
lcFormName = tcFormName
REQUERY( 'vwFormAlinks' )
REQUERY( 'vwPaths' )
SELECT vwFormAlinks
SCAN
  *!* Check to see if it is a valid path.
  IF EVAL( vwFormAlinks.Conditional )
    !* Check to see if we've found the goal form.
    IF vwFormAlinks.End_field = glTarget
      RETURN .T.
    ELSE
      *!* We need to keep looking
      RETURN TransversePath( vwFormAlinks.End_Field )
    ENDIF
  ENDIF
ENDSCAN
THERE'S A REALLY BIG FLAW in the above idea! :-) You've noticed that the cursor's are getting changed all over the place. I like the idea of using p-views here, but I don't know if it will be workable, since you'll need to keep resetting the data after the recursion starts popping up.

IAC, I'm really just trying to rough out the idea of how you might transverse the paths. It is the same concept if you use the tables and do it iteratively.

Anyway, I just offer it as a suggestion. I'll be looking for your posts to see how this goes. :)

>The contitional is evaluated by an object at runtime.
>For example give user is on form A-- condition in table must be .t. for user to move to form B so a user could get stuck on a Form A in definately if i set the condition to .f.
>
>All users start at Form A.
>
>I can stop searching once a path leads to form n
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform