AnsweredAssumed Answered

GetValuesForQuery

Question asked by sangel40 on Oct 28, 2016
Latest reply on Oct 28, 2016 by Patric

I have two lists, one contains salaries and the other contains tax rates that are applicable depending on the salary.

 

The 3 columns that I am concerned with are as follows:

 

Salary --->   Number    (Salary List)

MinimumSalary  ---->  Number    (Tax List)

MaximumSalary  ----> Number    (Tax List)

Tax Rate  ------>  Number (Tax List)

Tax Amount  --------->  Number (Tax List)

 

The Minimum and Maximum Values on the Tax List are as follows:

 

Min                                                  Max

0                                                      18000

18001                                              37000

37001                                              80000

80001                                              180000

180001                                            750000

 

This is the query I am using:

 

var x = [[@Web.GetValuesForQuery('REF-TAX-RATES','<Query><Where><And><Geq><FieldRef Name="MinimumSalary" /><Value Type="Number">[[SalaryPackageValueFT]]</Value></Geq><Leq><FieldRef Name="MaximumSalary" /><Value Type="Number">[[SalaryPackageValueFT]]</Value></Leq></And></Where></Query>', 'MaximumSalary')]];

 

When I use a Salary = 50000, I get a null returned.

 

If I use this query:

 

var x = [[@Web.GetValuesForQuery('REF-TAX-RATES','<Query><Where><Geq><FieldRef Name="MinimumSalary" /><Value Type="Number">[[SalaryPackageValueFT]]</Value></Geq></Where></Query>', 'MaximumSalary')]];

 

I only get the 80001 -----180000 and 180001 ----- 750000 information returned

 

With the first query I would have expected to get the 37001 -------- 80000 row returned and for the second one I would have expected to get the 37001 ---- 80000, 80001 -----180000 and 180001 ----- 750000 rows returned.

 

Ideally I would be able to return all of the columns on the Tax List row.

 

Any help you can provide on this would be appreciated or any alternative suggestions. I also saw the QueryList command and would appreciate an example of how this would look with my example above.

 

Thanks

Sandy

 

 

 

 

 

Outcomes