# Creating a new variable from a previous recordset

**URL:** <https://forum.kirupa.com/t/creating-a-new-variable-from-a-previous-recordset/98452>\
**Category:** Uncategorized\
**Created:** [January 7, 2004, 11:58am UTC](https://forum.kirupa.com/t/creating-a-new-variable-from-a-previous-recordset/98452 "2004-01-07T11:58:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![capt\_ace](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@capt\_ace](https://forum.kirupa.com/u/capt_ace)\
**Post date:** [January 7, 2004, 11:58am UTC](https://forum.kirupa.com/t/creating-a-new-variable-from-a-previous-recordset/98452/1 "2004-01-07T11:58:02Z")

</div>

I hope you can help.

I need to create a new variable from a previous recort set i have created. I’m using dreamweaver, so my hand coding isn’t great.

Let me explain,

I’m using a URl query to get one record at a time.

[COLOR=blue]\<%  
var rs\_article = Server.CreateObject(“ADODB.Recordset”);  
rs\_article.ActiveConnection = MM\_SHN\_STRING;  
rs\_article.Source = "SELECT \* FROM ARTICLE, PRI\_THEME, CREATOR, MATERIAL, ITEM\_LOC WHERE ARTICLE\_ID = “+ rs\_article\_\_MMColParam.replace(/’/g, “’’”) + " AND ARTICLE.PRIMARY\_THEME\_ID = PRI\_THEME.PRIMARY\_THEME\_ID AND ARTICLE.CREATOR\_ID = CREATOR.CREATOR\_ID AND ARTICLE.MATERIAL\_ID = MATERIAL.MATERIAL\_ID AND ARTICLE.ITEM\_LOCATION\_ID = ITEM\_LOC.ITEM\_LOCATION\_ID”;  
rs\_article.CursorType = 0;  
rs\_article.CursorLocation = 2;  
rs\_article.LockType = 1;  
rs\_article.Open();  
var rs\_article\_numRows = 0;  
%\>[/COLOR]

I need to creat a new variable that gives the value of CREATOR\_ID. This will then be used as a session variable to create another recordset.

[COLOR=darkred]  
\<%  
var rs\_related\_\_MMColParam = “1”;  
if (String(Application(“stheme”)) != “undefined” &&  
String(Application(“stheme”)) != “”) {  
rs\_related\_\_MMColParam = String(Application(“stheme”));  
}  
%\>  
\<%  
var rs\_related = Server.CreateObject(“ADODB.Recordset”);  
rs\_related.ActiveConnection = MM\_SHN\_STRING;  
rs\_related.Source = "SELECT ARTICLE\_ID, DC\_IDENTIFIER\_URI, DC\_TITLE\_EN, PRIMARY\_THEME\_ID, SUB\_THEME\_ID FROM ARTICLE WHERE SUB\_THEME\_ID = "+ rs\_related\_\_MMColParam.replace(/’/g, “’’”) + “”;  
rs\_related.CursorType = 0;  
rs\_related.CursorLocation = 2;  
rs\_related.LockType = 1;  
rs\_related.Open();  
var rs\_related\_numRows = 0;  
%\>[/COLOR]

Where stheme is the name of the new variable created.

I’m sure this is basic stuff, but it’s not my field…

Please let me know if you need further explanation.

Thanks,

Capt.
