Re: more dimensional method like a query...




Pi421 wrote:

> First i have stocks, depending on 4 attributes. Its like a tree, so
> there are 16 possible querys. Like the stock hat batchs, and the one
> patchs is reserverd for diffrent projekts and some of the materials in
> the stoch habe diffrent qualitys....
> So i want to programm a Method with 4 attributes. All combinations of
> the attributes are possible. Like getStock(batchA, ProjektX, QualityZ,
> conditionF).
> My question: How do i store the stock and how do i programm the
> getStock method. I think arrays are not the best way...

Where do the stocks live? In a database? In a collection in memory?

If the stocks live in a SQL RDBMS, you should attempt to meet the
requirement through a SQL query with an appropriate where clause,
bringing the minimum number of rows into your application space, and
winnowing them down further if you have additional constraints that
cannot easily be expressed in a SQL where clause.

If it's a collection in memory, the simplest thing is to iterate
through the collection and check each one for membership in your
restricted set. If one or two of the attributes are generally passed
to getStock as specific values, rather than wildcards or patterns, you
might want to create a map to narrow down the entries in the collection
that you need to search. I don't think you need to do much more than
that, linear searching in memory is very fast these days.

Another approach would be to represent the collection as an XML
document and use an implementation of XQuery to query the collection,
but that's probably more than what you need.

Regards,
Daniel Parker

.



Relevant Pages

  • Re: Stock Quotes in Excel 2008
    ... In the help and support file "How to create Web query files on page 3 there ... If I have 10 stocks in my portfolio Excel sheet, do I have to write 1 query ... There are several sample queries in the Queries folder in the Office ...
    (microsoft.public.mac.office.excel)
  • Re: Using expression in Query to limit table date used.
    ... I buy several stocks, hold them for four weeks then sell ... month is a period and has a unique number assigned by the autonumber field. ... >>I am trying to identify an expression that I can use in a query to limit ... Each line of monthly data has a unique number ...
    (microsoft.public.access.queries)
  • Re: Stock Quotes in Excel 2008
    ... In the help and support file "How to create Web query files on page 3 there ... If I have 10 stocks in my portfolio Excel sheet, do I have to write 1 query ...
    (microsoft.public.mac.office.excel)
  • Historical Share Price query
    ... I've got a MSN Money query in Excel that allows me to query a bunch of stocks at once to get the CURRENT share price. ...
    (microsoft.public.excel.misc)
  • rE: HELP PLEASE
    ... date, time, stocks name, price ... what is the command (or query languange) to get the ... aggregate query, in Ms acces but can it be done in SQL ...
    (microsoft.public.access.queries)