Logo Search packages:      
Sourcecode: relational version File versions  Download package

def relational::relation::relation::selection (   self,
  expr 
)
Selection, expr must be a valid boolean expression, can contain field names,
constant, math operations and boolean ones.

Definition at line 101 of file relation.py.

                            :
        '''Selection, expr must be a valid boolean expression, can contain field names,
        constant, math operations and boolean ones.'''
        attributes={}
        newt=relation()
        newt.header=header(list(self.header.attributes))
        for i in self.content:
            for j in range(len(self.header.attributes)):
                if i[j].isdigit():
                    attributes[self.header.attributes[j]]=int(i[j])
                elif rstring(i[j]).isFloat():
                    attributes[self.header.attributes[j]]=float(i[j])
                elif isDate(i[j]):
                    attributes[self.header.attributes[j]]=rdate(i[j])
                else:
                    attributes[self.header.attributes[j]]=i[j]
                
            
            
            if eval(expr,attributes):
                newt.content.append(i)
        return newt

Generated by  Doxygen 1.6.0   Back to index