Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TreeView coding
Message
 
À
29/05/2002 08:34:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00662378
Message ID:
00662388
Vues:
18
>I have a table members1 which have Key,Parent,Name as belows:-
> Key Parent Name
> 1_ 0_ Julie
> 2_ 1_ Bebe
> 3_ 2_ Lily
> 4_ 1_ Robert
> 5_ 2_ Liew
>
>
>
> SELECT Members
> o = THISFORM.memberlist.Nodes
> o.Clear
> SCAN
> IF ALLTRIM(parent) = '0_'
> o.add(,1,ALLTRIM(key),ALLTRIM(text),0)
> ELSE
> o.add(ALLTRIM(parent),4,ALLTRIM(key), ALLTRIM(text),0)
>
> ENDIF
> THISFORM.cNextKey = ALLTRIM(STR(VAL(key) + 1)+'_')
> ENDSCAN
> USE
>
> This coding will list out all the member name and their childs, if I want to choose only lily to list out,all member under Lily will list as well. I try to code
>cName=Thisform.cName.value
>Select Members
>If !seek(cName)
> Return
>Endif
>cParent = Parent
>Scan
>If Alltrim(Parent) = cParent
> o.add(,1,ALLTRIM(key),ALLTRIM(text),0)
> ELSE
> o.add(ALLTRIM(parent),4,ALLTRIM(key), ALLTRIM(text),0)
>
> ENDIF
> THISFORM.cNextKey = ALLTRIM(STR(VAL(key) + 1)+'_')
> ENDSCAN
> USE
>Endif
>
>It give an Error Message Invalid......
>
>
>Any suggestions? Thanks
Untested but I think you need to only scan for that record and those who are its children.
Select Members
If !seek(cName)
 Return
Endif
cParent = Key
Scan for Name==cName or Parent=cParent
  If Name==cName
    o.add(,1,ALLTRIM(key),ALLTRIM(text),0)
  ELSE
    o.add(ALLTRIM(parent),4,ALLTRIM(key), ALLTRIM(text),0)
  ENDIF
  THISFORM.cNextKey = ALLTRIM(STR(VAL(key) + 1)+'_')
ENDSCAN
HTH
Caroline
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform