Domanda

I am trying to create a view to find records of a certain date but the results are not what I want for an end result.

To start I want to view records who's start date is 3 weeks out. Simple enough.

.... StartDate   |   Next X Weeks |  3

This gets my records that are 3 weeks out cool......but it also returns records that are 1 week and 2 weeks out...which I don't want....but I don't see any way to exclude when working with dates? For example this psuedo query....

.... StartDate   |   Next X Weeks |  3
.... StartDate   |   ! Next X Weeks |  2
.... StartDate   |   ! Next X Weeks |  1

Now I haven't dug into seeing if this can be done by writing FetchXML directly....I figured Msoft would have addressed this by now and incorporated it into the UI...but perhaps I am wrong?

È stato utile?

Soluzione 3

I am very grateful to Paul & ad1ka's responses and they definitely taught me something new. However both were not quite what I was looking for and that I'm quite confident that is only because of my poorly worded question.

Here is what I ended up doing and feel free to comment / criticize.

I created a DateConmstants entity and added five records (there will be more). (The records have a name, date, and corresponding view name that it applies to).

I then created a maintenance workflow that executes every night to update the dates. For example record 1 is always to be 2 weeks out so the nightly workflow will update the record with the process exec time + 14 days.

I then created the views needing dates adjusted...(with bogus dates for now) with OnOrAfter and OnOrBefore thus creating a date "sandwich".

I then created a custom workflow that updates these views. It takes an input array of the views to be updated and the records from dateconstants that match the view.

The workflow then finds the view, loads the fetch into an xml. Using the xml find single node I find the OnorAfter and OnOrBefore values and update them. Then push the xml back to to query definition. Update and publish changes.

Finally this is scheduled as part of the afore mentioned nightly maintenance job.

So every day the users have views displaying the correct records with nothing extraneous.

FWIW

Altri suggerimenti

The UI only incorporates a subset of available operators. You could, However, use a dynamically built fetchxml which allows you to use the greater then operator and a specific date (today + 3 weeks). But this means you need to create your own view using something like the following using a webresource or an iframe.

Well unfortunately this logic isn't capable with FetchXML alone http://msdn.microsoft.com/en-us/library/gg309405.aspx

The "not" concept doesn't apply to dates, otherwise you could use the AND logic you specified above.

You can however create a web resource and then query the data you want via JCL or another library. Then you can parse the results to filter the first two weeks via JavaScript.

Or you can create the view with 3 weeks and sort by the date descending. This leaves extra noise at the end of the view, but may suffice.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top