RE: EACHMULTI processing: order issue, Keith Andersen, 04-23-2008
Oh, I see the problem
by Roger Harris, April 25, 2008 07:08
If $multirow$ is 1, you have:
<% SET GEOCOMBO = '$GEONAM$' %>
Those quotes around '$GEONAM$' mean that GEOCOMBO will be set to that exact literal string, not to the current value of $GEONAM$, which is what you wanted to do. So, first, you need to remove those quotes.
Then, when $multirow$ is 2 or more, you have:
<% SET GEOCOMBO = $GEOCOMBO$', $GEONAM$' %>
So, on multirow 2, GEOCOMBO is getting set to the current value of $GEOCOMBO$ (which is still the literal string '$GEONAM$'), plus the literal string ', $GEONAM$'. Now, when $GEOCOMBO$ is evaluated and found to contain the variable reference $GEONAM$, the *current* value of $GEONAM$ is substituted. But you're on the second row now, so the current value of $GEONAM$ is the second instance of the variable, not the value from multirow 1. So, your GEOCOMBO string will really begin with the second instance. Then, you're adding the literal sting ', $GEONAM$' to that, which again will be that exact literal string, not the current value of $GEONAM$. So $GEOCOMBO$ now contains the second instance, a comma, and another (unresolved) reference to $GEONAM$. That reference will be resolved on the third pass, with the third instance.
In other words, putting $GEONAM$ in quotes in your two SET statements is delaying resolving those references until the next pass, so it's getting replaced with the value from that next pass instead of the current pass. So, the solution is simply to remove those quotes around $GEONAM$ in your SET statements, so that it gets resolve immediately with the current value, not delayed until the next pass.
Name E-mail optional TopicMessage:
HTTP Link: Link text: