<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dabo.leafe.com/index.php?action=history&amp;feed=atom&amp;title=DataSet</id>
	<title>DataSet - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dabo.leafe.com/index.php?action=history&amp;feed=atom&amp;title=DataSet"/>
	<link rel="alternate" type="text/html" href="https://wiki.dabo.leafe.com/index.php?title=DataSet&amp;action=history"/>
	<updated>2026-11-21T12:30:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://wiki.dabo.leafe.com/index.php?title=DataSet&amp;diff=4032&amp;oldid=prev</id>
		<title>Ed at 15:07, 11 May 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.dabo.leafe.com/index.php?title=DataSet&amp;diff=4032&amp;oldid=prev"/>
		<updated>2020-05-11T15:07:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:07, 11 May 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You aren&amp;#039;t limited to a single DataSet, by the way. You can do multi-DataSet joins quite easily. The only catch is that you have to decide what alias names to use for each of the additional DataSets. Then pass a dictionary containing your alias:DataSet as the key:value pairs.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You aren&amp;#039;t limited to a single DataSet, by the way. You can do multi-DataSet joins quite easily. The only catch is that you have to decide what alias names to use for each of the additional DataSets. Then pass a dictionary containing your alias:DataSet as the key:value pairs.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;line=&amp;#039;line&amp;#039;&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;custDS = customerBizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;custDS = customerBizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ordersDS = ordersBizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ordersDS = ordersBizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DataSets have a &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt; method that allows you to easily control the rows in the data without having to create and execute queries. Additionally, filters can be removed using the &amp;lt;code&amp;gt;removeFilter()&amp;lt;/code&amp;gt; method; this will &amp;quot;unfilter&amp;quot; in the reverse order that the filters were applied to return to your original data. Example:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DataSets have a &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt; method that allows you to easily control the rows in the data without having to create and execute queries. Additionally, filters can be removed using the &amp;lt;code&amp;gt;removeFilter()&amp;lt;/code&amp;gt; method; this will &amp;quot;unfilter&amp;quot; in the reverse order that the filters were applied to return to your original data. Example:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;line=&amp;#039;line&amp;#039;&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  ds = bizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  ds = bizobj.getDataSet()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  print len(ds)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  print len(ds)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ed</name></author>
	</entry>
	<entry>
		<id>https://wiki.dabo.leafe.com/index.php?title=DataSet&amp;diff=4031&amp;oldid=prev</id>
		<title>Ed: Created page with &quot;Dabo cursor objects hold their data in DataSet objects. Internally, the class dabo.db.dDataSet is a tuple of dictionaries, where each element of the tuple represents a row in...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.dabo.leafe.com/index.php?title=DataSet&amp;diff=4031&amp;oldid=prev"/>
		<updated>2020-05-11T14:15:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Dabo cursor objects hold their data in DataSet objects. Internally, the class dabo.db.dDataSet is a tuple of dictionaries, where each element of the tuple represents a row in...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Dabo cursor objects hold their data in DataSet objects. Internally, the class dabo.db.dDataSet is a tuple of dictionaries, where each element of the tuple represents a row in the data; each row is represented by a dictionary with each key-value pair being a column name and its value in that row. You can get a DataSet by calling a bizobj&amp;#039;s &amp;lt;code&amp;gt;getDataSet()&amp;lt;/code&amp;gt; method. For those of you coming from a [[VisualFoxPro]] background, you can think of them as you would a Fox cursor.&lt;br /&gt;
&lt;br /&gt;
The cool thing about DataSets is that they understand SQL commands. You can run a SQL Select statement against the DataSet object, and a new DataSet containing the result of executing that statement is returned. The data in the original DataSet is unchanged.&lt;br /&gt;
&lt;br /&gt;
Since you aren&amp;#039;t querying an actual table, what do you use for the FROM clause? The convention we&amp;#039;ve adopted is to simply use &amp;lt;code&amp;gt;dataset&amp;lt;/code&amp;gt; in the FROM clause as the name of the source table. Like all SQL, this is not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
You aren&amp;#039;t limited to a single DataSet, by the way. You can do multi-DataSet joins quite easily. The only catch is that you have to decide what alias names to use for each of the additional DataSets. Then pass a dictionary containing your alias:DataSet as the key:value pairs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
custDS = customerBizobj.getDataSet()&lt;br /&gt;
ordersDS = ordersBizobj.getDataSet()&lt;br /&gt;
ordItemsDS = orditemsBizobj.getDataSet()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# If you are in an onHit() method of a GUI control:&lt;br /&gt;
# custDS = self.Form.getBizobj(dataSource=&amp;#039;name_of_table&amp;#039;).getDataSet()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Get all customers whose company name begins with &amp;#039;ST&amp;#039;&lt;br /&gt;
ds = custDS.execute(&amp;quot;select * from dataset where company like &amp;#039;ST%&amp;#039; &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Get several columns from the Orders table &lt;br /&gt;
ds = ordersDS.execute(&amp;quot;&amp;quot;&amp;quot;select order_net, shipped_on as shipDate &lt;br /&gt;
        from dataset&lt;br /&gt;
        where order_net &amp;gt;= 1000&lt;br /&gt;
        order by shipDate desc&amp;quot;&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Join all three DataSets together&lt;br /&gt;
aliasDict = {&amp;quot;ord&amp;quot; : ordersDS, &amp;quot;orditem&amp;quot; : ordItemsDS}&lt;br /&gt;
ds = custDS.execute(&amp;quot;&amp;quot;&amp;quot;select dataset.company, dataset.contact, &lt;br /&gt;
        ord.shipped_on, ord.order_net, orditem.unit_price, orditem.quantity, &lt;br /&gt;
        (orditem.unit_price * orditem.quantity) as itemTotal&lt;br /&gt;
        from dataset join ord&lt;br /&gt;
                on dataset.pkid = ord.cust_fk&lt;br /&gt;
        join orditem &lt;br /&gt;
                on ord.pkid = orditem.order_fk&lt;br /&gt;
        where dataset.company = &amp;#039;Franchi S.p.A.&amp;#039;&lt;br /&gt;
        order by ord.order_date&amp;quot;&amp;quot;&amp;quot;, aliasDict)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Replacing ==&lt;br /&gt;
You can replace the value of a field in a DataSet with a given value or expression by calling the replace() method of the DataSet, passing in the field name, the value/expression to replace that field with, and optionally a scope expression that will limit the affected records. The scope should evaluate to a boolean value for each row in the DataSet, and only those for which scope=True will be modified. The DataSet is modified in place; there is no return value from the replace() method.&lt;br /&gt;
&lt;br /&gt;
== Sorting ==&lt;br /&gt;
You can obtain a sorted copy of a DataSet by calling its sort() method and passing in the field name to sort on. By default, the sort is done ascending and case-insensitive; you can modify those defaults by passing in either of two additional parameters: asdesc (ASC or DESC) and caseSensitive (bool).&lt;br /&gt;
&lt;br /&gt;
== Filtering ==&lt;br /&gt;
DataSets have a &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt; method that allows you to easily control the rows in the data without having to create and execute queries. Additionally, filters can be removed using the &amp;lt;code&amp;gt;removeFilter()&amp;lt;/code&amp;gt; method; this will &amp;quot;unfilter&amp;quot; in the reverse order that the filters were applied to return to your original data. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight  lang=&amp;quot;python&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
 ds = bizobj.getDataSet()&lt;br /&gt;
 print len(ds)&lt;br /&gt;
 ## prints 100&lt;br /&gt;
 ds = ds.filter(&amp;quot;lastname&amp;quot;, &amp;quot;S&amp;quot;, &amp;quot;startswith&amp;quot;)&lt;br /&gt;
 print len(ds)&lt;br /&gt;
 ## prints 24&lt;br /&gt;
 ds = ds.filter(&amp;quot;income&amp;quot;, 80000, &amp;quot;&amp;gt;&amp;quot;)&lt;br /&gt;
 print len(ds)&lt;br /&gt;
 ## prints 6&lt;br /&gt;
 ds = ds.removeFilter()&lt;br /&gt;
 print len(ds)&lt;br /&gt;
 ## prints 24&lt;br /&gt;
 ds = ds.removeFilter()&lt;br /&gt;
 print len(ds)&lt;br /&gt;
 ## prints 100&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;removeFilters()&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; (note the plural) that will remove all filters on a data set at once.&lt;br /&gt;
&lt;br /&gt;
To apply a filter, pass in the field name to filter on, a matching expression, and (optionally) an operator. If no operator is supplied, the default of = will be used. You may also pass one of the following strings in, and the corresponding operator will be used:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Filter String&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Operator&lt;br /&gt;
|-&lt;br /&gt;
| eq&lt;br /&gt;
| =&lt;br /&gt;
|-&lt;br /&gt;
| equals&lt;br /&gt;
| =&lt;br /&gt;
|-&lt;br /&gt;
| gt&lt;br /&gt;
| &amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| gte&lt;br /&gt;
| &amp;gt;=&lt;br /&gt;
|-&lt;br /&gt;
| lt&lt;br /&gt;
| &amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
| lte&lt;br /&gt;
| &amp;lt;=&lt;br /&gt;
|-&lt;br /&gt;
| startswith&lt;br /&gt;
| LIKE%&lt;br /&gt;
|-&lt;br /&gt;
| beginswith&lt;br /&gt;
| LIKE%&lt;br /&gt;
|-&lt;br /&gt;
| endswith&lt;br /&gt;
| %LIKE&lt;br /&gt;
|-&lt;br /&gt;
| contains&lt;br /&gt;
| %LIKE%&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ed</name></author>
	</entry>
</feed>