protected static Ptg calcDSum( Ptg[] operands )
	{
		if( operands.length != 3 )
		{
			return new PtgErr( PtgErr.ERROR_NA );
		}

		DB db = getDb( operands[0] );
		Criteria crit = getCriteria( operands[2] );
		if( (db == null) || (crit == null) )
		{
			return new PtgErr( PtgErr.ERROR_NUM );
		}
		int fNum = db.findCol( operands[1].getString().trim() );
		if( fNum == -1 )
		{
			return new PtgErr( PtgErr.ERROR_NUM );
		}

		int count = 0;
		double sum = 0.0d;
		int nrow = db.getNRows();
		// this is the colname to match
		String colname = operands[1].getValue().toString();
		for( int i = 0; i < nrow; i++ )
		{    // loop thru all db rows
			// check if current row passes criteria requirements
			try
			{
				Ptg[] rr = db.getRow( i );
				
				/* "passes" means that there is a matching
				 * cell in the row of the data db cells
				 * 
				 */
				if( crit.passes( colname, rr, db ) )
				{
					// passes; now do action
					try
					{
						String fnx = db.getCell( i, fNum ).getValue().toString();
						if( fnx != null )
						{
							sum += Double.parseDouble( fnx );
						}
					}
					catch( NumberFormatException e )
					{
					}
				}
			}
			catch( NumberFormatException e )
			{
			}
		}
		return new PtgNumber( sum );
	}