Author |
Message
|
K9 |
Posted: Tue Apr 26, 2005 4:27 am Post subject: Intriguing and Perplexing - Muliple database selects |
|
|
Newbie
Joined: 26 Apr 2005 Posts: 3
|
Hey all been around for a while and found this site to be the place to go to for answers
Here is the scenario
A single database holds X records
I need regularly to select everyitem in the database based on a partiular column
for example
name address Telephone
a b 1
c d 2
e f 3
g h 4
i j 5
k l 6
so for any entry on telephone not equal to (<>) 0 select all the values for columns name, address, telephone
I then have to cretae a message based on each row
<message>
<name>a</name>
<address>b</address>
<telephone>1</telephone>
</message>
so for every ROW i have to PROPAGATE a message based on that rows contents.
OK here the catch
I can build a message and PROPAGATE it for a single lookup and that works fine
I cannot get round the every item portion
any help or ideas would be appreciated |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 26, 2005 4:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Have you considered using a loop? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
K9 |
Posted: Tue Apr 26, 2005 4:44 am Post subject: |
|
|
Newbie
Joined: 26 Apr 2005 Posts: 3
|
apologies have sorted the extract using RESULTSET which are automatically populated when a lookup is made
This has brought about another problem though
How do I incrment the Resultset Value used in the construction of the output message to match the value in the select?
eg
SET NAME = TRIM(TRAILING ' ' FROM Environment.RESULTSET.[1].NAME)
how do i up the [1] |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 26, 2005 4:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
K9 wrote: |
how do i up the [1] |
Have you considered using a loop? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Apr 26, 2005 5:09 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
How do I incrment the Resultset Value used in the construction of the output message to match the value in the select? |
By introducing a variable that you can increment:
Code: |
DECLARE resultsetIndex INTEGER 1;
WHILE ........
SET NAME = TRIM(TRAILING ' ' FROM Environment.RESULTSET.[resultsetIndex].NAME);
SET resultsetIndex = resultsetIndex + 1;
Do other stuff.....
END WHILE; |
You might want to also look at the FOR statement. |
|
Back to top |
|
 |
K9 |
Posted: Tue Apr 26, 2005 7:44 am Post subject: ****SOLVED****Intriguing and Perplexing - Muliple database |
|
|
Newbie
Joined: 26 Apr 2005 Posts: 3
|
Many thanks guys
Gothe lookup and resultsets working a peach and is generating a message via PROPAGATE
JT had to modify your code a little and ended up using the FOR statement as you recomended. |
|
Back to top |
|
 |
|