def test_not(self): expected = { "operator": "not", "criteria": [ { "fieldName": "cntn_id", "operator": "equals", "value": "test" }, ] } criteria = is_not(equals("cntn_id", "test")) self.assertEqual(expected, criteria.to_dict())
print("\n\nExample 3") records = slims.fetch( "Content", conjunction().add(is_not_null("cntn_id")).add( starts_with("cntn_id", "fish"))) # display_results has three arguments, the list of records, the list of fields # to display and finally the number of results to display display_results(records, ["cntn_id"], 10) # Example N_4: # Fetching content records with a disjunction (or). This filters content # records for which the cntn_id either contains "fish" or ends with "9" print("\n\nExample 4") records = slims.fetch( "Content", disjunction().add(contains("cntn_id", "fish")).add(ends_with("cntn_id", "9"))) display_results(records, ["cntn_id"]) # Example N_5: # Fetching in Content with a negation of the operator between. # This filters all the contents whose id is not between "00000002" and "00000166" # The sort is by cntn_barcode and then by cntn_id print("\n\nExample 5") records = slims.fetch("Content", is_not( between_inclusive_match_case("cntn_id", "00000002", "00000166")), sort=["cntn_barCode", "cntn_id"]) display_results(records, ["cntn_id"])
from web import form from slims.slims import Slims from slims.criteria import is_not from slims.criteria import equals from slims.content import Status render = web.template.render('templates/') slims = Slims("slims", "http://localhost:9999", "admin", "admin") # Populate the comboboxes # Searching for data by fetching order_types = slims.fetch("OrderType", None) content_types = slims.fetch("ContentType", equals("cntp_useBarcodeAsId", True)) locations = slims.fetch("Location", None) requestables = slims.fetch("Requestable", is_not(equals("rqbl_type", "WORKFLOW"))) dic_order_type = {} for order_type in order_types: dic_order_type.update({order_type.rdtp_name.value: order_type}) dic_content_type = {} for content_type in content_types: dic_content_type.update({content_type.cntp_name.value: content_type}) dic_location = {} for location in locations: dic_location.update({location.lctn_name.value: location}) dic_requestable = {} for requestable in requestables:
print("\n\nExample 3") records = slims.fetch( "Content", conjunction().add(is_not_null("cntn_id")).add( starts_with("cntn_id", "fish"))) # display_results has three arguments, the list of records, the list of fields # to display and finally the number of results to display display_results(records, ["cntn_id"], 10) # Example N_4: # Fetching content records with a disjunction (or). This filters content # records for which the cntn_id either contains "fish" or ends with "9" print("\n\nExample 4") records = slims.fetch( "Content", disjunction().add(contains("cntn_id", "fish")).add(ends_with("cntn_id", "9"))) display_results(records, ["cntn_id"]) # Example N_5: # Fetching in Content with a negation of the operator between. # This filters all the contents whose id is not between "00000002" and "00000166" # The sort is by cntn_barcode and then by cntn_id print("\n\nExample 5") records = slims.fetch("Content", is_not( between_inclusive("cntn_id", "00000002", "00000166")), sort=["cntn_barCode", "cntn_id"]) display_results(records, ["cntn_id"])