Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
What is DateColumn's value, and how is it used?

I am trying to use a function called get_loan_transactions_by_date_range() to get some information on loan transactions. As a part of the function's parameters, an object called date_column is needed that is derived from the DateColumn class. To use this class, a parameter called value is needed. The issue that I am running into is I cannot find anywhere in the documentation what value is supposed to be. How does a person use the DateColumn class using value?

This is a snippet of the code I am attempting to run:

page_counter = 1
yesterday = self.get_yesterday()

trans_obj = GeneratedTransactions(
		logger=self.logger,
		hq_credentials=self.hq_credentials,
		ret_table_obj=True
)

try:
		while True:
				date_column = DateColumn(value=1)
				transactions = await trans_obj.get_loan_transactions_by_date_range(
						start_date=yesterday,
						end_date=yesterday,
						date_column=date_column,
						page_number=page_counter,
						page_size=200,
						transaction_status_filter=None,
						filter_on_gt_data_name=None
				)
				if len(transactions) >= 1:
						self.logger.info(f'\n\n{transactions}\n\n')
						page_counter += 1
				else:
						break
except Exception:
		self.logger.error("""An error occurred when using \
		get_loan_transactions_by_date_range() to get a list of transactions.""")
		raise Exception

The docs on the function get_loan_transactions_by_date() and the DateColumn class can be found here: https://docs.q2developer.com/api_references/q2_sdk/db/db_objects/generated_transactions.html#q2_sdk.hq.db.generated_transactions.DateColumn

Posted 3 years ago
Votes Newest

Answers


The DateColumn class is an enum (enumeration) and is used to show the possible values in a descriptive way without needing to know what the actual values are. It is used a little differently than a typical python class. Instead of instanciating an object on the class, you use a dot to access the members in the class to pick which value you want.

Picking a create date column looks like this

date_column = DateColumn.CreateDate

You can ream more about enums here

Posted 3 years ago
Paden Rose
160 × 1 Administrator
94 Views
1 Answer
3 years ago
3 years ago
Tags