Link to home
Start Free TrialLog in
Avatar of Philippe Renaud
Philippe RenaudFlag for Canada

asked on

Help with Dictionary and LINQ Query

Hello EE,

In vb.net, I have a dictionary(Of Date, String).
Looks like this :

01/01/2018         Robert
01/02/2018         Steve
01/03/2018         Jenny
01/04/2018        Paul
01/05/2018        Veronica
etc
etc
etc
03/11/2019         Jenny

Open in new window



With this, in marketing we have some code that, if let's say as of now, if Jenny still was not picked up with our system, she will be in a list like this :

Jenny  - 90 days
robert - 56 days
Phil - 42 days
Catherine - 41 days
etc
etc
etc

Open in new window


meaning, its been 90 days that Jenny was not picked up by our system in marketing.
if tomorrow she gets picked up, she will be removed from the list and if the others were not picked, it will go like this :

robert - 57 days
Phil - 43 days
Catherine - 42 days

Open in new window


so Jenny is not in that dictionary(Of string, Integer) any more, but the others are and their days has been increased by one.


so all this works well.

My question is :   If I would like to check the history and the past, "who was picked up every week for the whole year", without manually writing it on a paper, how can I do it in vb.net ?
You see, we keep everything in the first dictionary I showed on top. the dictionary (Of Date, String) I have all the picks.

I would like to retrieve in the past, by week who was picked
so maybe in one week there is just 1 .. maybe in one week there are 3..
Because when it picks days goes to "zero" I have a hard time in vb.net, linq, and so forth, to do a function that goes back in time and read all this

can you help ?
Avatar of Norie
Norie

What does the first dictionary represent?
Avatar of Philippe Renaud

ASKER

the first dict is all the picks date and name.

so I have all the history of date and the person.

what I would like of a result is a Dictionary(of Date, Dictionary(Of String, Integer)   that tells me:

03/03/2019, (Jenny, 90)
02/24/2019, (Robert, 67; Adam 55)
02/17/2019, (Mike, 100; Isabella, 65)
02/10/2019 .. and so on like this


The result means :

Jenny got pick at 90 days on the week of 03/03/2019
Robert go pick at 67 days and adam at 55 days, on the week of 02/24/2019
Mike got pick at 100 days and isabella at 65 days, on the week of 02/17/2019
Come on guys! help me =)))

it's a long description problem, but its really that not hard to understand, and im sure 100% you guys can do it, its just that I am not the best developer, I have my limits.
Your question is a bit confusing:  Is this just one, ever-running application? Are you keeping these people in memory the whole time? It seems weird that you would have these people in an in-memory data structure (i.e. a dictionary) and talk about "history". Can you expand upon your system design here?
Well ok : the first Dictionary of Date / String is being populated from a Text file.

so in the text file I have all the dates and names of the selection (I call them the picks)
so when I run the vb.net software, I have all this in a dictionary(of date, string)

then I created I second dictionary (of string, integer) that shows me how many days some names has not been picked.
so if you see Jenny 90 days,  it means that, between NOW() and her last entry in my textfile (the first dictionary), the date is 90 days apart.


so as days goes by, picks happens.
so the results I would like is, like I said, to have a (it doesnt have to be a dictonary) but a list by week, of who was picked over lets say 52 week period, without me going manualyl checking "Ahh Mike is not in my dictionary today, but wait a minute? when was he picked? so I have to go manually check, when was he picked..etc..."
ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial