E.g. there is a list with gazillion required fields and I want the users to be able to fill out whatever they can and save as a draft until they have full info? Is there a simple solution for this? Tia!
Option 1: Multiple Content Types
One approach is to have two different Content Types on your list: one for draft items and one for submitted ones.
Content types on the same list can have different settings for the same columns. This means you can make the fields optional on the "draft" content type while making them required on the "submitted" content type.
The downside is that it may not be intuitive for end users if they're required to manually change the "Content Type" field in order to publish their draft.
Option 2: List Validation Settings
Another approach is to use List Validation settings instead of making fields required.
List validation lets you specify an Excel like formula (from which you can reference column values) which must evaluate to true in order for the validation to succeed. If it evaluates to false, a validation error message is displayed instead (you can specify the text of that message) and the item cannot be saved.
Simplified Scenario: One Field
Suppose you have a field called First Field that you don't necessarily need to be filled out right away, and you also have a choice field called Status Field that's used to indicate whether an item is a draft version or is submitted (displaying either "Draft" or "Submitted").
You can set up a list validation formula that requires First Field to be filled in whenever the Status Field is changed to "Submitted".
The formula would look like this:
=If([Status Field]="Submitted",NOT(ISBLANK([First Field])),TRUE)
In plain English, that formula is saying:
If Status Field is equal to Submitted...
...Then the form is valid only if First Field is not blank.
Otherwise, the form is valid.
More Complex Scenario: Multiple Fields
To make that work for multiple fields, you can join conditions together using the OR() and AND() functions, in the format of OR(condtion1,condition2)
So instead of ISBLANK([First Field]) to check whether a field is blank, you'd have something like OR(ISBLANK([First Field]),ISBLANK([SecondField])) to check whether either of two fields is blank. (Replacing First Field and Second Field with your field titles as appropriate.
The formula would now look like this:
=If([Status Field]="Submitted",NOT( OR(ISBLANK([First Field]),ISBLANK([Second Field]))),TRUE)
Note that you can nest multiple OR() conditions together arbitrarily, in the format of OR(condition1, OR(condition2, OR(condition3, condition4))) (and so on indefinitely).
Offloading Formula Complexity to Calculated Columns
If you run into limits with the formula length, you can offload some of your condition calculations into their own calculated columns, then just refer to those column values from your validation formula.
This can also help keep your formula from looking so complex.
For example, for every field that you want to be required, you can create a calculated column with a formula of =NOT(ISBLANK([Column Name])) and name it something like "{Column Name} Is Valid". Then you can refer to those columns in your validation formula:
=If([Status Field]="Submitted",AND([Field1 Is Valid],AND([Field2 Is Valid],[Field3 Is Valid])),TRUE)
Related
I am trying to make a form that will give users a list of possible defects to choose from when reporting a customer complaint. First they will choose from a list of regions on the product where the problem exists and then they will choose from a list of possible defects which will populate based on the location selected in the first list. I have made the list of regions as comprehensive as possible but I feel that it is likely that something will arise where I have not forseen this issue as a possibility. As such I would like to include an "Other" option in the location drop down list which, when selected, would change the second data entry point from a data validation list to allowing the user to typ anything the user would like to add. Is this possible to have the type of data validation dependent on a condition?
Dependent dropdown lists validation. Reference youtube video one and two
You can mention "Others" option on the top of the source list for the first (Location) validation. You can then add data validation for the first list using named range with offset function. This will allow you to freely add other locations at the bottom of the list.
For the second column validation, you can enter formula skipping the first ("Others") cell in the location list.
In the image below, validation source list for column D is $A$2:$A$10 and validation list formula for Column E is =IF(COUNTIF($A$3:$A$10,$D2)>0,$B$2:$B$10,$E2)
I´m trying to set up unique values in my PowerApp-Form. The data is stored in a Sharepoint list. I have a column called watches, items in this column have a unique number, which have to be unique. People can pick multiple of those watches in a LookUp-field. But before submitting the form, I need to check if those picked values already exist in my list and at least display an error message.
I have setup a regular text field and added following rule to it:
If(LookUp(MyList.Watches;DataCardValue4.SelectedItems.Value in Watches;"OK")<>"OK";"No Error";"Watch already exist")
DataCardValue4 is my LookUp field, where people can pick those watches. With this rule I want to check if a item already is in my column watches and let my text field display the error. Somehow the rule doesn´t work.
Can you tell me how I compare multiple lookup choices to my table/column entries?
The first parameter to the LookUp function should be the table (SharePoint list) rather than the column. So the first parameter should be 'MyList' rather than 'MyList.Watches'. Also, I'm not sure that the formula provided (second parameter to LookUp) will work. In your formula, you will be looking for multiple items (DataCardValue4.SelectedItems.Value) within multiple items (Watches). Perhaps you can update your app to have users only pick one watch value before submitting?
One last thing to note. I'm not sure how big you expect your SharePoint list to get, but I would highly recommend keeping your LookUp formula within the bounds to support delegation. More specifically, SharePoint has different formula requirements than other connectors. For example, you can use '=' in your formula, but not 'in'.
Your new rule might look something like below. Please note that it could have syntax errors and might not even be delegable in it's current form since I am providing the rule with no checking. Also, I switched from using LookUp to using Filter instead just because I'm more familiar with Filter. However, both functions are very similar.
If(CountRows(Filter(MyList; DataCardValue4.Selected.Value = Watches)) > 0; "Watch already exist"; "No Error")
I created many Lists and they are getting longer. At the moment i am using data validation, so I have big lists and need to select the name i want
They are all listed on my formulas, so i would like to know if there is any way
to start to write the name that i need and excel already shows the
possibilities...
I tried to use this formula but was not successful
=OFFSET(Sheet1!$A$1,0,0,MATCH("*",Sheet1!$A$1:$A$300,-1),1)
For instance i have a list of currencies called "CCY", i would like to write
"US" and excel already shows USD. Is there any way to do that?
=OFFSET(Currency,MATCH(A2&"*",Currency,0)-1,0) 'A2 is where the validation applies, make sure it accepts values not in list
You can enter the value in a second go, will let you select from values after.
I wouldn't use it but
It will let you select any value from the drop-down
You can let it do its job by typing "us", Tab, Shift+Tab, Alt+Down and Tab quite fast.
The formula below won't let you select values after, takes the first match only, handle with care.
=OFFSET(Currency,MATCH(A2&"*",Currency,0)-1,0,1,1) 'fun fact: you can give names to data table columns thus creating expanding lists
In my Lotus Notes Database, I want to fill the choices available in a dialog list based on the previously entered values for this field.
I set type of the field to "Dialog list", chose "Use formula for choices" and selected "Allow values not in list".
However, I don't know what to enter as a formula:
The formula's result should be all values for the field Foo specified in the database.
I tried the following formula which results in an empty list, however:
#Unique(SELECT Foo)
There are definitely documents with values for Foo in the database.
Which formula can I use?
Or do you know better solutions to my problem than using a formula?
Many thanks in advance for your responses!
You need to create a view with at least a column that displays the Foo field. You can then use #DbColumn in your formula to retrieve all values from e.g. column 1 containing the Foo field:
#Unique(#DbColumn("";"":"database.nsf";"Your new view";1))
Here is more informatiom about #DbColumn: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_GENERATING_CHOICES_FOR_LISTS_STEPS.html
Similar way, but error handling included.
Look := #DbColumn("":""; ""; "$LookFoo"; 1);
#If(#IsError(Look); ""; #Unique(Look))
Database parameter can be empty, if you are reading from the current. If there is a problem with cache, you can make first parameter like - #DbColumn("":"NoCache";...
Hope it helps.
I am working on an infopath 2010 form/view based on a list.
I have 7 separate check box fields that I want to check through a rule under submit button that at least one of them should be selected.
Trying to do this and check for the condition, it is allowing me to check a maximum of 5 fields at a time.
How can I check at least one of these 7 check boxes is selected before submitting the data?
You can overcome this by changing your last condition to "The expression" and use "and" or "or" as needed to create your compound condition. So, for example, if you need to make sure both field1 and field2 are not blank, you'd use the expression:
my:myFields/my:field1 != "" and my:myFields/my:field2 != ""
If you need help figuring out the correct syntax for your expression, first set up the condition using the drop downs (for example, select field1 in your first drop down, then "is not blank" in your second drop down), then change the first drop down to "The expression" -- whatever your condition was will auto populate into the box for the expression. Paste that into a text editor, and then do the same for the rest of your conditions. Add and or or between them as needed, and you have your expression!
Source: http://www.infopathdev.com/forums/p/14871/52819.aspx
I had a similar issue and avoided using "The Expression" option because I had so many conditions to check before allowing a user to submit the form for certain scenarios, and it would have been very tough to debug and troubleshoot. I also considered Glen's sum-based solution because it made troubleshooting difficult as you can't really tell which condition is missing, and you can't perform logical checks on what's been selected or filled-in properly.
My solution was to set up a text CheckStatus field and a numeric CheckStatus-Value field. Rules on tested fields would add values to the CheckStatus field when the needed conditions were met. And when the CheckStatus-Value field hit the “magic number” (6 in the example below), then I would allow the user to submit the form. As an example, the CheckStatus-Value and CheckStatus fields are shown below, but would be hidden when the form is ready for production use:
CheckSum-Value & CheckSum fields
Then for every desired field, I assign a unique letter from “A” to “Z”, or from “a” to “z”, or from “0” to “9”, and test for the desired condition. In this way you could test for up to 62 concurrent conditions, tho that would be a bit crazy 😊 Every time the CheckStatus field changes, a rule runs to count the number of values and update CheckStatus-Value:
Update CheckSum-Value field
IF the condition is True AND the CheckStatus field does not already contain the unique letter/number assigned to that field, then I add the assigned number/letter (using the concat function) to the CheckStatus field. If a blank value is a valid value under specific conditions then I add the letter/number for the field when that condition is met, so a ready-to-submit form always has the same value in the CheckStatus-Value field. (If a valid value is changed to a different valid value, ensure the letter/number is only added ONCE to the CheckStatus field.)
Add value A to CheckStatus field
IF the condition is False, then I remove the assigned number/letter (using the translate function) from the CheckStatus field.
Remove value A from CheckStatus field
IF the field being tested (Field-A) is dependent on another field (Field-B), I also add the Field-A rule to Field-B, so the user does not have to touch Field-A to update the CheckStatus. Be careful when copy-pasting the rules; remember InfoPath will change field names automatically! I also added the “’Add-x”’ rules to the Form Load rules (on the Data tab) to update CheckStatus every time the record is loaded.
Hope this helps!
-Steve
Here's an idea: Use an integer field and put a rule on each of your 7 checkboxes that adds 1 to the field. Then your final validation rule just needs to be sure the integer field is greater than zero
(Better also have a rule to subtract 1 if a box is unchecked after being checked.)
-Glen