Solved

Find Duplicates

Posted on 2003-11-06
12
442 Views
Last Modified: 2013-12-18
Fairly simple.  

Just laziness though.  I have a list and I would like to have another list derived from this that would list only the duplicate items....

Anything is fine.  @Functions / LotusScript I dont care.

:-)
Arun.

Example:

SourceList : one , two, three, four, one, one, two, five ,  six , seven

ResultList : one, one, two
0
Comment
Question by:Arunkumar
  • 5
  • 4
  • 3
12 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 9694545
Dim alreadyFound List as Integer
Set onlyDups = doc.replaceItemValue "onlyDups" , "Ignore first element - just a header"
Forall element in doc.FieldWithDups
   If IsElement(alreadyFound(element)) Then
     onlyDups.appendToTextList element
   Else
     alreadyFound(element) = True
   End If
End Forall
0
 
LVL 9

Author Comment

by:Arunkumar
ID: 9694786
That was good.... Qwaletee. Now add 50 pts to the question and answer this one....

Dim stTimeRange As NotesDateTime
      Dim edTimeRange As NotesDateTime
      Dim sysTime As NotesDateTime
      
      Set stTimeRange = New NotesDateTime("11/06/2003 07:00:00")
      Set edTimeRange = New NotesDateTime("11/06/2003 18:00:00")
      Set sysTime = New NotesDateTime("11/06/2003 10:00:00")
      
      Print "Start Time " & stTimeRange.TimeOnly
      Print "End Time " & edTimeRange.TimeOnly
      Print "CurrentTime " & sysTime.TimeOnly
      
      
      If (systime.TimeOnly > stTimeRange.TimeOnly) And (systime.TimeOnly < edTimeRange.TimeOnly) Then
            Print "The currentTime is falling in work hours."
      Else
            Print "The Time is beyond work hours"
      End If

Why does this always say not in range ?  Can you fix this one for me..??
0
 
LVL 9

Author Comment

by:Arunkumar
ID: 9694817
I just gave you a bunch of pts on an old question.  Lets keep the point saga going....
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 9694865
1) You're comparing strings
2) Could be a timezone-problem, you didn't include your timezone in the NotesDateTime-calls
0
 
LVL 9

Author Comment

by:Arunkumar
ID: 9694906
Well, i just got around with it by adding Hour before all the time variants....and i am about to test it now.
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 50 total points
ID: 9698301
Yeah, TimeOnly is one of the stupider bits of the object model.  WHy string?  You can easily convert to string when needed, usually implicitly.

When trying to compare times, I sometimes use the LotusScript time handling facilities.  The datetime is represented as a real (floating point) number, with the whole number portion representation a date serial number, and the fraction representing a portion of a day.  So, the difference between today 3:00 PM and tomorrow 6:00 PM is 1.125 (one full day plus 1/8 day -- 6:00-3:00=3 hours, 3/25=1/8, .125=1/8).  If you know all the datetime values are for the same date, you can simply compare the two numbers -- the later time will always be a larger number.

If the dates can be different, but you just want to compare the time portion, you can eliminate the whole number portion.  x-clong(x) gives the fractional part of x.  So, you could use (systime.lsLocalTime-clong(systime.lsLocalTime)) > ...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 50 total points
ID: 9707374
Sorry if I barge in a bit, but your original question was bugging me. Could it be done in @Formula language? Well, I haven't found the real solution yet, since @Replace is too thorough for my needs, but I did find a "solution". If someone else can find a neater solution to this puzzle, I'd really like to hear it!

v:= "one":"two":"three":"four":"one":"one":"two":"five":"six":"seven";
n:= "1":"2":"3":"4":"5":"6":"7":"8":"9":"10";
vs:= @Sort(v);
vsu:= @Unique(vs);
vsn:= @Replace(vsu; vsu; n);
r:= @Replace(vs; vsu; vsn);
x:= @TextToNumber(r);
x1:= @Subset(@text((x:0)-(0:x)); @Elements(v));
x2:= vs+x1;
@Explode(@Trim(@Implode(@Left(x2; "0"); " ")); " ");

And how it works? That's for you to find out!

;-) Sjef
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9709047
@Sort was introduced with R6, in which case you may as well use the looping mechanism.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 9709565
Sure, I know, and n cannot be generated automatically. Nevertheless, the thing works, and without explicit looping instructions, for that's what's so charming about lists in Notes. You could even write it as a one-liner, making it unreadable, almost like APL but then the other way around.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9712365
Wow!  APL!  that would easily generate N: ~i 10
0
 
LVL 9

Author Comment

by:Arunkumar
ID: 9738862
Hey guys here is a continuation question. i will increase the pts accordingly while grading...

I have a customer running 5.08 and are experiencing a intermittent problem within one group of the organization.  The problem is that on random, so they say, messages, that if the user forwards the message or if they reply to all with history the message is blank except for the new text that has been written.

I looked on ldd and saw quite a bit of this, but it all related to messages
within the iNotes environment.

Any thoughts ?
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9744593
Any possibility someone likes to use "hide when copying" or "prevent copying."

And of course, you are trying to confuse everyone by having two completely different questions here!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now