The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Recordsets within the VB Script...
Posted: 21 Feb 07 4:46 AM
|
fiogf49gjkf0d I'm trying to get a Recordset/Class/Property bucket to work within VB script of the web client. I understand that this probably like trying to build a house out of Jelly, however it would make my life a million times easier if I can get it to work.
The problems I've found so far are that ADO isn't supported, classes don't appear to be supported and array's aren't dynamic enough. What I need is basically a dynamic array or any other form of dynamic property bucket.
Any help, ideas or advice will be greatly received. |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 4:53 AM
|
fiogf49gjkf0d Could you give me an idea of what the dynamic property bucket is to do? Ive not familiar with this term...
Thanks |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 5:12 AM
|
fiogf49gjkf0d What I mean by property bucket is basically a detached recordset that can contain variable amount of rows, hence why the array is out since that has to be a fixed at the time of creation of the array and from my experience can't be based on a variable value at that time.
The problem I'm trying to over come is one of auditing web pages. Every change to a field has to be recorded with certain information (Name of field, old value, new value, user, and time changed), now I'm doing this through VB script on the post of the web page. Currently I have this working for one page as well, however it is very long winded and a very messy way of doing it and also I have to get it working for almost the entire application. That is why I'm trying to use a detached recordset to hold those values that have changed and thus need to be recorded to the audit table. The reason I can't use the array is because I don't know how many records have changed at the time of the creation of the array.
Hope all that makes sense and thanks for the reply.
Richard |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 5:30 AM
|
fiogf49gjkf0d Ok - hmmm I must admit I dont use ADO in the Web, and to do what you are trying to do here I ended up doing it the 'messy' way i.e. an IF structure setup for all controls on the page (and testing if their old values are different from the posted values). Very tedious. As for ADO not being un-useable im not sure, I know you can use CreateObject so dont see why you cant use ADO.
There is also the possibility of using PostedLineCount which will allow you to loop through all of the postedvalues from the form to check for changes against the db - you could then check the values of the posted form against the db before the Update to the main table occurs and perhaps create a pipe delimited string of all those fields that have changed. Then loop through the pipe delimited string and write to your audit table. Hows that for messy?? This approach assumes you can match a posted value to a database field (this could be done via the SLXWebAlias table I believe.
Actually im getting a head ache just thinking about doing that.... |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 7:21 AM
|
fiogf49gjkf0d Originally posted by Richard Fisher
I'm trying to get a Recordset/Class/Property bucket to work within VB script of the web client. I understand that this probably like trying to build a house out of Jelly, however it would make my life a million times easier if I can get it to work.
The problems I've found so far are that ADO isn't supported, classes don't appear to be supported and array's aren't dynamic enough. What I need is basically a dynamic array or any other form of dynamic property bucket.
Any help, ideas or advice will be greatly received. |
|
Although I haven't tried in the web client, you can resize an array any time you need to. Just dim the array variable:
dim arr
Then when you know how many fields changed, redim the array:
redim arr(fieldcount)
EDIT: Seems [CODE] doesn't work.... Ryan, is it possible to have "code" tags in this forum??
|
|
|
| |
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 9:14 AM
|
fiogf49gjkf0d you probably want to use redim preserve so that you dont loose the contents of the array. Also in a multidimensional array in vbscript only the last dimension is redimmable.
so you could ****************** dim arr() redim arr(0,0) arr(0,0) = "Jason" redim preserve arr(0,1) msgbox(arr(0,0)) '(shows Jason) ******************
if you didnt do the PRESERVE it shows nothing
but you cannot redim preserve arr(2,1) since that would include the first dimension.
|
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 10:52 AM
|
fiogf49gjkf0d Thanks for the feed back everyone it is all much appreciated.
It's certainly given me some other avenues to try.
I'll let you know how I get on. Thanks again for the replies. |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 1:50 PM
|
fiogf49gjkf0d Originally posted by Doug Miller
EDIT: Seems [CODE] doesn't work.... Ryan, is it possible to have "code" tags in this forum?? |
|
Hi Doug. For now, you can wrap the code in <pre></pre> tags. The new version of this site I've been working on, slxdeveloper v2, will have support for BBCode tags as well as a nice way to have formatted code in your posts. More to come on that later |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 2:11 PM
|
fiogf49gjkf0d Originally posted by Ryan Farley
Hi Doug. For now, you can wrap the code in <pre></pre> tags. The new version of this site I've been working on, slxdeveloper v2, will have support for BBCode tags as well as a nice way to have formatted code in your posts. More to come on that later |
|
Nice. Thanks Ryan! |
|
|
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 3:01 PM
|
fiogf49gjkf0d If we're really talking about web client actions (and not VB Script), ReDim does NOT work in web client actions...been down that road too many times.
Jeff
|
|
|
| |
| |
|
Re: Recordsets within the VB Script...
Posted: 21 Feb 07 5:43 PM
|
fiogf49gjkf0d but if you want to redim, then the initial dim should NOT specify any sized array ---> Dim x() Redim x(24,32) or whatever |
|
|
|