You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a query that returns the display values when using the response.all() function, but I cannot get the display values when using the response.get_multiple() function.
the following does not resolve the display values, any help would be appreciated.
client = _client()
# to resolved linked table to their display names and not the foreign key
client.parameters.display_value = True
# only return these fields
incident_fields = ['number', 'u_application', 'assigned_to', 'u_department_billing']
client.parameters.fields = incident_fields
start_dt = datetime.datetime.strptime(start, '%Y-%m-%d')
end_dt = datetime.datetime.strptime(end, '%Y-%m-%d')
query = ( snow.QueryBuilder()
.field('assignment_group').starts_with(assignment_group)
.AND()
.field('sys_created_on').between(start_dt,end_dt)
.AND()
.field('u_application').is_not_empty()
.AND()
.field('assigned_to').is_not_empty()
.AND()
.field('u_department_billing').is_not_empty()
)
response = client.query('incident', query=query)
for ticket in response.get_multiple(fields=incident_fields, offset=50, limit=50, order_by=['-sys_created_on']):
......
this works
client = _client()
# to resolved linked table to their display names and not the foreign key
client.parameters.display_value = True
# only return these fields
incident_fields = ['number', 'u_application', 'assigned_to', 'u_department_billing']
client.parameters.fields = incident_fields
incident = client.resource(api_path = '/table/incident')
start_dt = datetime.datetime.strptime(start, '%Y-%m-%d')
end_dt = datetime.datetime.strptime(end, '%Y-%m-%d')
query = ( snow.QueryBuilder()
.field('assignment_group').starts_with(assignment_group)
.AND()
.field('sys_created_on').between(start_dt,end_dt)
.AND()
.field('u_application').is_not_empty()
.AND()
.field('assigned_to').is_not_empty()
.AND()
.field('u_department_billing').is_not_empty()
)
response = incident.get(query=query)
del _cache_incident
_cache_incident = pd.DataFrame()
for ticket in response.all():
.........
The text was updated successfully, but these errors were encountered:
A little more work and could not determine (a) how to configure get_multiple() to return the display values, it returns only the links to the objects or (b) the all() function return the specified fields, it returns all incident fields.
# <get_multiple()>
# >>>>>>>>> Uses the client the return is a request object <<<<<<<<<<
client.parameters.fields = incident_fields # only return these fields
response = client.query('incident', query=query)
for ticket in response.get_multiple(fields=incident_fields, offset=50, limit=50, order_by=['-sys_created_on']):
...
# </get_multiple>
# <response.all()>
# >>>>>>>>> Uses the resource object return is a response object <<<<<<<<<<
incident_res = client.resource(api_path = '/table/incident')
incident_res.parameters.display_value = True
incident_res.parameters.fields = incident_fields # only return these fields
response = incident_res.get(query=query)
for ticket in response.all():
....
# </response.all()>
I have a query that returns the display values when using the response.all() function, but I cannot get the display values when using the response.get_multiple() function.
the following does not resolve the display values, any help would be appreciated.
this works
The text was updated successfully, but these errors were encountered: