Solved

comparing dates

Posted on 2006-06-29
8
278 Views
Last Modified: 2013-12-18
Hi all,

If I have datelista and datelistb
I want to compare those so that those in datelista that are smaller than the last date in datelistb are in my result array. Would @replace achieve this result

datelista:05/06/2006, 07/08/2006, 10/10/2006, 10/12/2006, 01/02/2007, 01/03/2007
datelistb:05/06/2006, 10/10/2006, 01/02/2007
resultlist should display: 07/08/2006, 10/12/2006 ONLY. 01/03/2007 date should not appear in the result list because its date is higher than the last date in datelistb.

I've attempted using @replace from all the examples given before but I seem to get either the entire datelista or the entire datelistb

Does anyone have time to give a hand with this?

Thank you all in advance.
0
Comment
Question by:varvoura
  • 5
  • 3
8 Comments
 

Author Comment

by:varvoura
Comment Utility
Actually can you use @compare in this scenario?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
Comment Utility
@Compare, hm, maybe, but it's more difficult than with @Transform:
    lastdate:= @Subset(datelistb; -1);
    resultlist:= @Transform(datelista; "x"; @If(x<lastdate; x; @Nothing));
0
 

Author Comment

by:varvoura
Comment Utility
Brilliant as usual.

I applied it with a couple of small changes and it worked magic.
Better still, I look it up and in help and I know exactly how it works.

Many thanks,

Varvoura
0
 

Author Comment

by:varvoura
Comment Utility
Sjef,

I have a small problem,
this works fine on existing documents, however on new documents i get the value, comparison operators have to be the same type. The two fields are date fields, however, the datelistb is a computed field which does a lookup to get its value and if it is a new product then its original value is null. Is there a way around this problem.
got too excited too soon.

Thanks
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
An additional check should do wonders, but I suppose you found that out already. If not:

    lastdate:= @Subset(datelistb; -1);
    resultlist:= @If(!@IsTime(lastdate); "";
                        @Transform(datelista; "x"; @If(!@IsTime(x); @Nothing; x<lastdate; x; @Nothing))
                    );
0
 

Author Comment

by:varvoura
Comment Utility
I did checking first to make sure that the field value I was comparing to wasn't null, then I tried to convert both value to @texttotime before @Transform. Your method is much easier and shorter.
I seem to use a lot of lengthy solutions, i wish I can abbreviate like you do

Thank you
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
It took me 25 IT-years and a lot of headaches to get these twisted brains. ;)
0
 

Author Comment

by:varvoura
Comment Utility
25 years, now that's a lot years. does this mean that I have 20 years before my brain can twist this way????????????????

I have lots of respect for your twisted head though!!!

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

11 Experts available now in Live!

Get 1:1 Help Now