• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Formula Question....

Hi...Have two fields in a form A1 & A2.

both the fields can store multiple values in it. each value is 13 bytes long.

Now I've to put a validation so that no duplicates can be entered.
In A1's input translation I've @Unique(A1)
In A2's input translation I've @Unique(A2)  

But i also want to restrict this. If a value in in A1 and the same value is in A2. it should give an error message.

I did put the following in A2's input validation.
@If(a2 = a1;@Failure("cannot enter duplicates");@Success)...

But this works only for some values.(Not sure why... may be becuase A1 and A2 are multi-value fields)

thanks
Kalios
0
kalios
Asked:
kalios
1 Solution
 
HemanthaKumarCommented:
use

@If(a2 *= a1;@Failure("cannot enter duplicates");@Success)...

~Hemanth
0
 
kaliosAuthor Commented:
great so *= is the trick..

Hemanth, is there a way to show the duplicate in the error message.

thanks
0
 
HemanthaKumarCommented:
There is..
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
kaliosAuthor Commented:
How?
0
 
kaliosAuthor Commented:
sorry, i've no more points left. i'll have to buy them. i'll for my next question.
0
 
p_parthaCommented:
Kalios
Use @keywords

Partha
0
 
HemanthaKumarCommented:
Let me paste the formula here

List := A1 : A2;
num := "0" : "1" : "2" : "3" : "4" : "5" : "6" : "7" : "8" : "9";
idList := @Subset( num *+ num *+ num; @Elements(List));
tmp1 := @Unique(@Replace(List; List; idList));
tmp2 := @Trim(@Replace(idList; tmp1; ""));
@Replace(tmp2; idList; List);
0
 
qwaleteeCommented:
Neat, been a while since I saw that one.  Ah, the joys of list processing.
0
 
kaliosAuthor Commented:
I can just say ONLY one thing..

SUPER HEMANTH - If I could increase the font size I would do it to the biggest.

thanks
Kalios
0
 
kaliosAuthor Commented:
It returns all the duplicates. I've used  num*+ num*+ num*+ num  as i've more values here.

also, once I save the document it displays me all the duplicates which is great. but i also want this.
once i click ok on the message all the duplicates should be removed from A2.


thanks
Kalios.
0
 
kaliosAuthor Commented:
Hemanth, I get the list of all the duplicates as return which is great. is it possible to remove duplicates from A2 by using formula or do i have to write a script for that.
0
 
kaliosAuthor Commented:
ok i get it...

a := @Replace(A2;fieldwhereistoredduplicatesfromyourcode;"");
@If(fieldwhereistoredduplicatesfromyourcode = a2; @SetField("a2";a) ;"");
@Command([ViewRefreshFields])

this works fine.... can i do any better.
kalios
0
 
HemanthaKumarCommented:
You are good with the code
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now