Home » Knowledge bases » General » Select an item from a dataset
Select an item from a dataset [message #90] Tue, 13 November 2007 12:38 Go to next message
Qnowledge  is currently offline Qnowledge
Messages: 57
Registered: August 2005
Location: Netherlands
Member
This is a simple example to show the mechanisme how to select an itme from a dataset.

The top goal is "SelectItem". When started you will be requested to provide the criterium ("ItemCriterium") for the selection (in this example number 1, 2, 3 or 4).

The result will be the value of "Item" corresponding with the value provided for "ItemCriterium".

Please note that the |OPTIONS| script is used in "Selection#":

|OPTIONS|
2
"DATA#" "DATA"
"Item" ""
|


combined with the QUERY# function to query the dataset.

In this script "DATA#" "DATA" makes sure the data in the DATA object in the dataset is found, and "Item" "" makes sure at least "Item" is returned as result.

Read the reply below, I made a small mistake. The reply contains the correct example...

[Updated on: Fri, 16 November 2007 11:28]



http://quaestor.org/pub/80x15%20By%20Qnowledge.png
Re: Select an item from a dataset [message #92 is a reply to message #90 ] Fri, 16 November 2007 11:26 Go to previous message
Qnowledge  is currently offline Qnowledge
Messages: 57
Registered: August 2005
Location: Netherlands
Member
After testing in an older Quaestor version (internally we are now using 2.46.1), we discovered that the example did not entirely work.

As a result herewith I post a knowledge base (inclusing a Quaestor version constraint as choice) with a slightly modified knowledge base.

How it works:
In the Dataset of the knowledge base the data is available in the DATA object.

To select the item from this DATA object (for Quaestor version below 2.46) we define a relation for top goal SelectItem:

SelectedItem = QUERY#(Selection#, "NullString", ItemCriterium).Item

SelectItem will use Selection#, to get its data. To make sure Selection gets its data from the DATA object, in the dataslot of Selection# you define:

|OPTIONS|
1
"DATA#" "DATA"
|


The alternative in Quaestor versions above 2.45 is:

SelectedItem = QUERY#(@DATA, "NullString", ItemCriterium).Item

Now you directly refer to DATA. This is only possible if DATA is a static data object in the Dataset (so it has the @STATIC attribute).

My apologies for the previous knowledge base, but enjoy the new example,

Best regards,

Timo

[Updated on: Mon, 01 September 2008 14:08]



http://quaestor.org/pub/80x15%20By%20Qnowledge.png
Previous Topic:@MAXVAL attribute example
Next Topic:Value replacement in an input file
Goto Forum:
  


Contact  Home