Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Support Forum

Using Variable Substitution with Table.BulkUpdate
radar717 asked:
What's the deal?

I'm trying to do a bulk update on some records using the current session ID.
Here's my code:  (It doesnt work)

var JFilter2 = Request.getSessionID();
Table.bulkUpdate("Shop_Cart", {Closed_WebOrder:1}, "Session_ID = '#jfilter2#'", false);

This code works:
Table.bulkUpdate("Shop_Cart", {Closed_WebOrder:1}, "Session_ID = '8741749B59F14C6893F428CC25A60515'", false);

The only difference is the way the session_id is set.  Please explain to me why I can't get the first example to work.  I've already verified numerous times that the values are identical. 

Here's the strange part:
If I move the first table.bulkUpdate out of script range it substitutes the correct value and creates the second example.  All I have to do is move it into script range and the expanded strings works!!!  Weird.
  mike responded:
  I'm not sure the exact context of this script, but this should work:

var JFilter2 = Request.getSessionID();
Table.bulkUpdate("Shop_Cart", {Closed_WebOrder:1}, "Session_ID = '" + jfilter2 + "'", false);

The # substitition isn't performed when you're already in script, but appending the string should work.
  dougl responded:
  Mike is correct.

#substitution# only works to begin a script and end a script block. The # operate very similarly to <!--# #--> in views and very similarly to {} in script (only they do not create a new scope...)

I'm not sure what you mean by "script range"
  radar717 responded:
  Thanx that worked.  I think I had a mental block on that one.  I tried every combo I could think of EXCEPT a straight append.

And what I meant by script range was inside or outside the script delimiters.
  radar717 responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

DataWeb Support
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us