Salesforce Rule: if one field populated, then prevent population of the second field - validation

I would like to ask for a help with Salesforce. The official Salesforce communities website encounters a login bug, so I thought I would ask here, as always I got the positive reception here.
I would like to create the rule which will make unable to click the Potential Duplicate field if Left Organization is already marked as True. Could anyone help me to create such rule?

Create a validation rule that checks in the formula:
AND (
NOT( ISBLANK(potential_duplicate_field__c),
Left_Organization__c
)
assuming potential_duplicate_field__c is a text or some such and Left_Organization__c is a check box.

Ok. I have found the solution meanwhile. If anyone looks for the answer for similar case this code will help
AND(Left_Organization__c=TRUE,Potential_Duplicate__c=TRUE)

Related

Combining 'Isblank Status' with an imbedded 'IF' statement

I am trying to combine the following two statements together and struggling to combine them.
The first one is checking the outcome of survey questions where the outcome is either "Pass" or "Fail".
The second one is if the overall questionnaire column is blank (the survey has not been filled in yet), I would like the cell to be populated with "" (blank, not show anything. Currently I am seeing "Fail")
1st Formulae:
=IF((AND(H18="No",I18="Yes",J18="No",K18="Yes",L18="2 Metres",M18="Yes",N18="Yes",O18="Yes",P18="Yes",Q18="Yes")),"Pass","Fail")
2nd Formulae:
=if(and(isblank(H2:Q2))," ",)
Any help would be appreciated
Regards
Caroline
I think this combination works:
=IF((AND(H18="No",I18="Yes",J18="No",K18="Yes",L18="2 Metres",M18="Yes",N18="Yes",O18="Yes",P18="Yes",Q18="Yes")),"Pass",if(COUNTA(H18:Q18),"Fail","blank"))
If they enter something, but not correctly, they "Fail", if they entered everything correctly, they "Pass", and if it is blank, this shows "blank".
You can change "blank" to "" (ie. empty quotes) if you don't want anything shown for a blank record.
Here is a sample sheet:
https://docs.google.com/spreadsheets/d/1rGCeNF_Eje7UrpM3PK9YTk_3ZKBo1qOAVEVoRVmqyRs/edit?usp=sharing
Please check back here and flag if this answers your question, to help others in the future. If not, please clarify what's missing.
Note that this may not be the most efficient way of handling your survey responses, since the correct answers are all 'hard coded' into the formula. If it makes sense for you, it might be better to have the correct answers stored as a list - one answer per question - so that you could add or change questions in the future, without having to change the formula. If that's what you'd like, share a COPY of your sheet, with any sensitive data removed, and set the SHARE options to allow anyone to edit.

How to check for any answer satisfying a condition

I have just started with Prolog and I have come to a roadblock. I have searched for an answer to this here and on google for maybe 2 hours now. Its probaly really easy and I probably missed it but I am about to give up so please help me.
I dont really know how to ask the question so here is an example.
Lets say I have this:
related(football, sport).
related(thing, otherthing).
related(rugby, sport).
I want to make a rule. One of the conditions in this rule is to check if I am related to anything.
rule(A) :- <Here I want to check if A is related to anything> , othercondition(A).
I need to know if its related to anything at all. What it is related to does not matter.
using
rule(rugby).
for example would give me true since rugby is related to sport.
I hope my question is clear enough.
You could write:
rule(A):-related(A,_),othercondition(A).
Note that '_' is anonymous variable and matches with anything.

How to make the cities/countries dropdown like facebook does?

See the screenshot here:
I'd like the user to just type a city or country name and the autocompleter will show suggested items.
How should I start for creating it?
Are there any API(s) or web services for me to call?
Where can I find the database of all cities/countries in the world?
I think this would be the best database for your situation, check it out:
http://www.geodatasource.com/cities-free.html
You first need a autocomplete plugin.
I recommend to use the jQuery-Ui Auto Complete Plugin.
The database could as example be this, but eventually try to search a bit for yourself.
There was already a question on stackoverflow about a database for cities of the world.
A simple text file with all cities may also be this.
There are very much of those libraries, but you have to chose the right one for you.
My solution may not be the best, but it's a starting point:
Google a list with all countries (ISO-Standard), paste it into a txt-file. Then you can simply read that file with PHP an create a select menu with the contents of the file.
It does not incorporate the cities, but maybe it helps you in some way.

OR condition in JQgrid's toolbar search

I'm very new to JQgrid. I have a requirement which i'm not able to solve.
I'm using toolbar filer with searchonenter as true and data is local.
The rquirement is if a user types 'apple banana' in the filter textbox of a column then the filter should fetch the rows with text as apple or banana.
Can anyone please give an idea on how to implement this?
Thanks,
suneel
I posted before the answer on the same question.
The problem is that not accepted and not voted answers will be practically never found by searching. It's the problem if one answers on the questions of persons having minimal reputation points. I strictly recommend all to read carefully the How do I ask questions here? in the FAQ.
I recommend you additionally to modify the title of your question so that one could understand more from the reading of the title.
Best wishes!
When you call the function to create the filtertoolbar, you have an option 'groupOp' which default is AND, you can change to OR as follow:
$('#jQGrid').jqGrid('filterToolbar', { groupOp: 'OR' });
Hope it make sense for you.

Detecting misspelled words

I have a list of airport names and my users have the possibility to enter one airport name to select it for futher processing.
How would you handle misspelled names and present a list of suggestions?
Look up Levenshtein distances to match a correct name against a given user input.
http://norvig.com/spell-correct.html
does something like levenshtein but, because he doesnt go all the way, its more efficient
Employ spell check in your code. The list of words should contain only correct spellings of airports.
This is not a great way to do this. You should either go for a control that provides auto complete option or a drop down as someone else suggested.
Use AJAX if your technology supports.
I know its not what you asked, but if this is an application where getting the right airport is important (e.g. booking tickets) then you might want to have a confirmation stage to make sure you have the right one. There have been cases of people getting tickets for the wrong Sydney, for instance.
It may be better to let the user select from the list of airport names instead of letting them type in their own. No mistakes can be made that way.
While it won't help right away, you could keep track of typos, and see which name they finally enter when a correct name is entered. That way you can track most common typos, and offer the best options.
Adding to Kevin's suggestion, it might be a best of both worlds if you use an input box with javascript autocomplete. such as jquery autocomplete
edit: danish beat me :(
There may be an existing spell-check library you can use. The code to do this sort of thing well is non-trivial. If you do want to write this yourself, you might want to look at dictionary trie's.
One method that may work is to just generate a huge list of possible error words and their corrections (here's an implementation in Python), which you could cache for greater performance.

Resources