Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Nested Loops



******    message to minivend-users from "Bill Randle" <billr@exgate.tek.com>     ******


Brent,

I don't remember seeing a reply on the list to your question. Did you
get what you needed working? You could try something like this in
your results page (untested):
    <SELECT NAME=mylist1>
     [search-list]
       <OPTION VALUE="[item-code]"> [data 'mydb' 'myfield' '[item-field nkey]']
     [/search-list]
    <SELECT>

This would take the results of your search and put the item code as the value
in the select box and lookup the text to display in the 'mydb' database
using some field (e.g. 'nkey') from the returned search as the key to
access the 'myfield' column.

This is only convienient for a single SELECT box, as you'd end up with
multiple <SELECT>[search-list]...[/search-list]</SELECT> sections on
your page, which is probably not real efficient. As an alternate, you
can use the MVASP (basically, inline Perl) to build up the select
boxes all at once then write out the HTML. [Is mvasp supported in later
3-x verions, or just 4.x? I forget....] Anyway, here's an example based
loosely on an example that Mike setup for me awhile back, modified to
more closely fit what you're trying to do:

[set name=data interpolate=1][search-list][item-code]|[item-field
mfr]|[item-field model]|[item-field club]|[item-field head]
[/search-list][/set]

[mvasp tables="products dictionary" global=1]
<%
    no strict;
    my @items = grep /\S/, split /\n/, $Scratch->{data};
    my (%clist, %hlist, $key);
ITEM: for(@items) {
        my($code, $mfr, $model, $club, $head) = split /\|/, $_;
        # lookup full text name of the club given its code name
        my $clubname = $Tag->data('dictionary', 'name', "$club");
        # and the head type text, given the head code
	my $headtype = $Tag->data('dictionary', 'name', "$head");
        $clist{$club} = $clubname;
	$hlist{$head} = $headtype;
    }
    HTML("Choose club: <SELECT name=club>");
    foreach $key (keys %clist) {
        HTML("<OPTION value=$key> $clist{$key}</OPTION>");
    }
    HTML("</SELECT>\nChoose head: <SELECT>");
    # here's a slightly different way, don't know if it's more or
    # less efficient
    my @out;
    foreach $key (keys %hlist) {
        push @out "<OPTION value=$key> $hlist{$key}</OPTION>";
    }
    push @out "</SELECT>";
    HTML(@out);
%>
[/mvasp]

	-Bill Randle
	Tektronix, Inc.
	billr@exgate.tek.com

On Feb 3, 10:41am, Brent Worley wrote:
} Subject: [mv] Nested Loops
} ******    message to minivend-users from "Brent Worley" <brent@12ave.com>
    ******
}
} I am implementing a page that returns results to a select box.  The problem
} lies in the fact that I am using two different databases.  The first
} database gets a specific code, and the second database pulls the description
} for that code.  Is there a way to specify the database used for each
} different loop?
}
} Thanks.
}
} Brent Worley
}
} -
} To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
} email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
} Archive of past messages: http://www.minivend.com/minivend/minivend-list
}-- End of excerpt from Brent Worley


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: