View Filtered by Current Date
I know it’s possible to filter a view based on a static date. Is it possible to filter a view so the date is “today’s date” rather than a predefined date?
I have a custom asset for data set certifications that includes an expiration date. I would like to have two views- one that shows those that have not expired based on expiration_date > current_date and one that shows those that have expired.
Former User
Posted 5 years ago · Edited 1 year ago·Last reply 3 years ago
14 comments
Mehjabeen Sultana
·3 years ago · EditedI referred to this post https://datacitizens.collibra.com/forum/t/refresh-conflict-notifications/151/15
I don’t want to delete the refresh conflict information.
arthurburkhardt
·5 years ago · EditedWell, if you can identify a relatively small number of assets (by typeId or domainId or communityId), it can be relatively easy to loop through them.
If you have complex query needs, I would recommend to use the outputModuleApi. Here’s such an example that can help filter out those assets that have a “due date” attribute greater than a certain threshold. You can use the output module via java and rest api.
The output module allows you to go crazy and filter on status, community, domain, asset type, attributes, and more, in a very efficient way.
Here’s a small python example
last_month = datetime.datetime.today() - relativedelta.relativedelta(months=1) threshold = int(last_month.timestamp())*1000 query = {"TableViewConfig": { "Resources": { "Term": { "Id": {"name": "id"}, "Signifier": {"name": "name"}, "ConceptType": {"Id": {"name": "assetTypeId"}, "Name": {"name": "assetType"}}, "Vocabulary": {"Id": {"name": "domainId"}, "Community": {"Id": {"name": "communityId"}}}, "Status": {"Signifier": {"name": "status"}}, "DateAttribute": [{"labelId": "c0e00000-0000-0000-0001-000500000193", "Date": {"name": "dueDate"}},], "Filter": {"AND": [ {"OR": [{"Field": {"name": "assetTypeId", "operator": "EQUALS", "value": "daaf28e9-a73b-4d83-bd7f-db110512c632"}}, {"Field": {"name": "assetTypeId", "operator": "EQUALS", "value": "548585f7-ac1b-4483-8ced-08d570c0d9b0"}}]}, {"Field": {"name": "communityId", "operator": "EQUALS", "value": "4f4670ba-eaf9-428d-97f7-d350b879b668"}}, {"Field": {"name": "dueDate", "operator": "GREATER", "value": threshold}}, ]} } }, "Columns": [ {"Column": {"fieldName": "id"}}, {"Column": {"fieldName": "dueDate"}}, {"Column": {"fieldName": "status"}}, {"Column": {"fieldName": "Due date"}}, ] }} r = c.post('outputModule/export/json', json=query) df = pd.json_normalize(r.json()['aaData']) df['Due Date'] = df.dueDate.apply(lambda x: datetime.datetime.fromtimestamp(int(x)/1000).isoformat() if x else '') dfarthurburkhardt
·5 years ago · EditedWell, if you can identify a relatively small number of assets (by typeId or domainId or communityId), it can be relatively easy to loop through them.
If you have complex query needs, I would recommend to use the outputModuleApi. Here’s such an example that can help filter out those assets that have a “due date” attribute greater than a certain threshold. You can use the output module via java and rest api.
The output module allows you to go crazy and filter on status, community, domain, asset type, attributes, and more, in a very efficient way.
Here’s a small python example
Mehjabeen Sultana
·3 years ago · EditedHi @arthur.burkhardt,
I am trying to use refresh conflict OOTB workflow.
This workflow sends notification with a list of all the assets with refresh conflict. My use case needs me to send notifications of the conflicts that are latest, conflicts that are added probably in last 24 hours.
Through output module:
I have tried to use “created on” attribute, but this does not work since the created on returns the time when the asset was created on and not the time when refresh conflict attribute was added
I create a flag attribute (true/false) to indicate notification are sent for a given refresh conflict. I want to update this attribute when the notification is sent. this way I can filter the assets on which refresh conflict exist but notification was already sent.
the issue is: this attribute is null for all the assets. I want to set it to false so that when I pick them for notification I can update them to true. How can I set the default value of the attribute?
Is there any other attribute type that can set default values?
can there be a better approach to this problem?
Thank you
@kristen.freer Can you please get me some help on this?
Former User
OP5 years ago · EditedThanks, Arthur.
My thought was something similar to that, but I don’t know how to search search through multiple assets to find those that match the criteria.
arthurburkhardt
·5 years ago · EditedHow about this solution?
Create one attribute called “Up for revision” or “Due today”
Create a workflow that runs on a daily basis:
This way, you can create a view that will only show assets that match the criteria for a given day.
If you want an example workflow that uses a daily time trigger: Daily Notification of Refresh Conflicts - Collibra Marketplace
S Benson
·5 years ago · EditedI have a similar, but slightly different question. Can a view be created to find an Asset with a date 1 year past? But of course, the date will be dynamic. For instance, find every Agrement with a “Last Reviewed Date” of today-365?
Scott
Former User
OP5 years ago · EditedThanks for the suggestion, but how do I cycle/search through all of the assets of a given asset type? Armed with that knowledge, I could do this.
Richard
alvinuseree
·5 years ago · EditedSadly this isn’t possible yet.
If your date is always in past, your best bet would be to sort the results by date. Perhaps that is somewhat of a happy compromise?
Former User
OP5 years ago · EditedIn other words, have the indicated filter always just show the current date rather than setting it manually each time the view is accessed.
noor
·5 years ago · EditedHi Richard, I meant this hard-coded date value being stored in a separate attribute, updated daily, and used as filter.
I think Jeff’s solution options too partly talk about it.
Former User
OP5 years ago · EditedI store the date in an attribute. I just want to filter by a > or < comparison with that attribute. It sounds like it’s not possible.
noor
·5 years ago · EditedI also would like to know if that is possible. I guess for such a thing, an attribute is required to store the date?
jeffgreene
·5 years ago · EditedHi Richard,
As of version 7.04.21 there is not an out of the box feature of search search filters that would make the requests possible and make them dynamic. However there are some features / options in the advanced filter that may get close to the solution (close in that it is dynamic). You could filter in advanced filter, last modified in the last x days, or last reviewed in the last x days.
A custom worflow or API script would have to be created to search the assets and compare the current date to the experation date and then create the views.
Best,
Jeff