/    Sign up×
Community /Pin to ProfileBookmark

Tabular Data Control

I am trying to filter data using the Tabular Data Control and filter on numeric values (2999, 3999, 3098 etc). The filter I used is :

.Filter = “Price>=” + rate1 + “&” + “Price<=” + rate2

Where rate1 and rate2 are the range of prices to return. But it returns the following values:

Example – Filter between 1000 and 1999. It will return values of:

1999
1789
1000
11098

It seem to be only evaluating the first number. Any Ideas on why the greater than /less than comparitors don’t work?

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 05.2004 — The string isn't quite right:

.Filter = "(Price>=" + rate1 + ") & (Price<=" + rate2+")"
Copy linkTweet thisAlerts:
@maxb88authorMay 05.2004 — I changed the code to reflect your changes and it still is operating in the same behavior. It seems to be only evaluating the first digit.
Copy linkTweet thisAlerts:
@FangMay 05.2004 — Does the substitution work?

.Filter = "(Price>=1000) & (Price<=1999)"

What does | (or) give as a result?

Do you use the .Reset() method after .Filter method?
Copy linkTweet thisAlerts:
@maxb88authorMay 05.2004 — Yes - I use the .Reset on the object after the filter. I put in the filter you listed and it returns every value that begins with a 1, even if the number is greater than 1999.
Copy linkTweet thisAlerts:
@FangMay 05.2004 — Is the header setup correctly; the default is text, not interger.

If .Filter is searching for text rather than a number, it could cause the odd results.
Copy linkTweet thisAlerts:
@maxb88authorMay 05.2004 — How do I tell if its text or interger. Column heading are listed in the file it reads. Is there a property in the file or Tabular Data control I have to change?
Copy linkTweet thisAlerts:
@FangMay 05.2004 — [URL=http://msdn.microsoft.com/workshop/database/tdc/reference/useheader.asp]UseHeader Property[/URL]
Copy linkTweet thisAlerts:
@maxb88authorMay 06.2004 — I have this field set to negative 1. Which is true - still getting same results.
Copy linkTweet thisAlerts:
@FangMay 06.2004 — Here's a quick one:

mydata.txt
FoodItem,Price:Int
Bread,1570
Cheese,3052
Wine,1839
Eggs,800

selected.html
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Basic Data Binding&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
&lt;!--
function Show() {
selectlist.Filter = "(Price&gt;=1000) &amp; (Price&lt;=1999)";
selectlist.Reset();
var str="";

selectlist.recordset.MoveFirst();
for (var i = 1; i &lt;= selectlist.recordset.AbsolutePosition; i++) {
str+= selectlist.recordset("FoodItem")+selectlist.recordset("Price")+"&lt;br /&gt;";
selectlist.recordset.MoveNext(); <br/>
}
document.write(str);
} <br/>
//--&gt;
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="Show()"&gt;
&lt;object id="selectlist" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"&gt;
&lt;param name="DataURL" value="mydata.txt"&gt;
&lt;param name="UseHeader" value="True"&gt;
&lt;/object&gt;
&lt;/body&gt;
&lt;/html&gt;

This works as expected. See if you have any differences, or post your code and file.
Copy linkTweet thisAlerts:
@maxb88authorMay 06.2004 — Change your data to the following:

FoodItem,Price:Int

Bread,1570

Cheese,1052

Wine,18390

Eggs,800

Milk,100

Leave the filter as is:

selectlist.Filter = "(Price>=1000) & (Price<=1999)";

And try it, this would be comparable to my data.

Thanks for your help. Let me know if it works.
Copy linkTweet thisAlerts:
@maxb88authorMay 06.2004 — How did you get the ":Int" at the end of the Header. Did you use excel to create the file. I have excel files that I save as either Tab delimited or Comma delimated. Is there a option in excel to have the ":Int" attached? I thinks that was the problem. I have to test some, but will let you know. Thanks your all your help.
Copy linkTweet thisAlerts:
@FangMay 06.2004 — Returns:

Bread1570

Cheese1052

as expected, the [I]:int[/I] was added manually.
Copy linkTweet thisAlerts:
@maxb88authorMay 06.2004 — The ":Int" was what I needed. I put it in the header field next to the "Price" label which is the column of the data that being evaluated and it worked. I appreciate all the help you have given me. Thanks.
×

Success!

Help @maxb88 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...