ReadEqualMode enum | QSYS API Reference Guide
Estimated reading time: 4 minutes
Specifies the mode for reading equal data.
Namespace: ASNA.DataGate.Common
Assembly: ASNA.QSys.DataGate.Client.dll
Enum Values
Name | Description | Value |
---|---|---|
NextEqual | Specifies that the reading starts from the next equal record. | 17 |
PreviousEqual | Specifies that the reading starts from the previous equal record. | 18 |
Examples
AdgConnection db = new AdgConnection("*Public/DG NET Local");
FileAdapter dbFile = new FileAdapter(db, "*Libl/CSMASTERL1", "CSMASTERL1");
dbFile.AccessMode = AccessMode.Read;
AdgDataSet myDS = null;
dbFile.OpenNewAdgDataSet(out myDS);
/* We read all of the records for customer 300 in order to get
* their net sales as well as their average yearly gross sales
* and returns. */
AdgKeyTable custNoKey = myDS.NewKeyTable("RCSMastL1");
custNoKey.Row["CSCustNo"] = Convert.ToDecimal(300);
custNoKey.KeyPartCount = 1;
decimal totalSales = 0;
decimal totalReturns = 0;
int saleRecordsRead = 0;
int returnRecordsRead = 0;
bool EOF = false;
dbFile.SeekKey(SeekMode.SetLL, custNoKey);
while(!EOF)
{
try
{
dbFile.ReadSequentialEqual(myDS, ReadEqualMode.NextEqual, LockRequest.Read, custNoKey);
if (Convert.ToDecimal(myDS.ActiveRow["CSType"]) == 1)
{
totalSales += Convert.ToDecimal(myDS.ActiveRow["CSSales01"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales02"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales03"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales04"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales05"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales06"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales07"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales08"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales09"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales10"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales11"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales12"]);
saleRecordsRead ++;
}
else
{
totalReturns -= Convert.ToDecimal(myDS.ActiveRow["CSSales01"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales02"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales03"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales04"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales05"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales06"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales07"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales08"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales09"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales10"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales11"]) +
Convert.ToDecimal(myDS.ActiveRow["CSSales12"]);
returnRecordsRead ++;
}
}
catch(dgException dgEx)
{
if (dgEx.Error == dgErrorNumber.dgEaEOF)
{
EOF = true;
}
else
{
MessageBox.Show("Error getting next record for customer 300:" +
dgEx.Message, "Error");
//Exit procedure or end application here.
}
}
}
/* Compute additional results. */
decimal netSales = totalSales - totalReturns;
decimal averageSalesPerYear = totalSales / saleRecordsRead;
decimal averageReturnsPerYear = totalReturns / returnRecordsRead;
if (saleRecordsRead > 0)
averageSalesPerYear = totalSales / saleRecordsRead;
else
averageSalesPerYear = 0;
if (returnRecordsRead > 0)
averageReturnsPerYear = totalReturns / returnRecordsRead;
else
averageReturnsPerYear = 0;