Hi Patrick,
Try this:
- Make a copy of the Asset Tracking sample
- Make sure this still works as you need
- Optional: Remove all entries from the "sort" drop-down boxes except for:
at:category
- Open the Microsoft Script Editor
- Locate the following line of code in the btnReSort::OnClick event:
g_xpathSortBy = getNodeValue("/at:assetTracking/at:tempSortBy");
- Comment this line and place it with:
g_xpathSortBy = "at:category";
- Save and close the script editor
- Save the new sample
- Double-click the XSN, add some data and test...you should see that your
data is sorted by Category.
Now, the main reason for this exercise is to insure that having just one
item in the drop-down does indeed work but also to demonstrate that even
though you have just one item, you would probably still want to use a
drop-down list so you can display a "friendly" name of how the data is
being sorted. That is, unless you just want to remove it completely from
the form.
Based on the behavior you described, it sounds like your XPath may be in
error. Add the line: debugger; to your button's click event and use the
"F11" key to step through the code to see exactly what line is failing.
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.