Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Challenge 7: string of child fields in each parent rec
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Query Challenge 7: string of child fields in each parent rec
Divers
Thread ID:
00208157
Message ID:
00208157
Vues:
56
I have a query that reads values from one table and also is supposed to use a UDF to assemble a string of values from a related table. If I JOIN the other table in the query (using a common table, because the two tables are related many-many) I get only the first value in the string. If I leave that other table out of the join, the query gets nothing from the UDF, even though the UDF is trying to return the correct string (verified with a WAIT WINDOW). The goal is to format data from two tables in a particular way for a web program (from West Wind) that expects a single cursor. The original Fox report ran directly off the table and called the UDF in a report object. I have:
THINGS
thingnum  description
1         something
2         something else
3         yet another thing
DOCS
docnum    docdescript
1         "important doc"
2         "more important"
3         "whatever"
THINGDOCS
thingkey  dockey
1         1
1         2
2         3
3         2
3         3
I want a query THINGSWITHDOCS that would look like:
thingnum  docstring
1         "important doc/more important"
2         "whatever"
3         "more important/whatever"
The Help says that you cannot assume anything about work areas and aliases when you use a UDF in a query and I'm sure that it is part of my problem. So, my attempts to do SELECT thingnum, getdocs(thingnum) FROM things are not working, because getdocs wants to open another work area. When I join docs and thingdocs to things with various JOIN, LEFT JOIN, or FULL JOIN, I get duplicates or blank doc strings or only the first item in the docstring.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform