Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i have a list that is controlled by an infopath form and i am trying to add a calculated column to the list (because a value will need to change dynamically and if i use infopath to do the calculation, it would require a reopen/save of the form)

is this supported? i get an error.

the formula is just "=[CalcPALID]+1"

share|improve this question

2 Answers 2

up vote 1 down vote accepted

What error do you get? The formula for the calculated column looks correct, although the brackets are only required if the column name contains spaces.

It works fine in my test when I add a new calculated column with that formula. The column CalcPALID must contain a number, though. If it contains text, then you cannot use it for mathematical calculations. The column type can be text, as long as it can be interpreted as a number.

A calculated column will not show in an InfoPath list form by default. It will be represented in the data source by a calculated field control, which can be dragged onto the canvas if desired.

share|improve this answer
    
Data source is represented by data fields. Controls are visualization frames for data fields as data sources. There can be data fields/sources without controls and controls with data sources/fields. Calculated value control does not have underlying data source/data field. Only data fields can be represented assharepoint columns –  Gennady Vanin Геннадий Ванин Apr 4 '13 at 0:20
    
Also, field names cannot contain spaces and special charcters in Infopath. Yake it or leave it –  Gennady Vanin Геннадий Ванин Apr 4 '13 at 0:26
    
Pardon? Try this: Create a SharePoint list with a calculated column. Edit the list form in InfoPath. The calculated column will show as a field in the data source. In "basic view" it will show with the symbol for the "calculated value". If you drag it onto the canvas it will be a "calculated value" control. –  teylyn Apr 4 '13 at 0:26
    
I think I am completely missing the points and the ways how to guarantee screwing things –  Gennady Vanin Геннадий Ванин Apr 4 '13 at 1:08
    
thank you for the info on Calculated Fields and Infopath. Very helpful. i should have created a NEW field instead of trying to change my infopath form field to become a calculated value field. makes sense now. –  April Drake Apr 4 '13 at 19:45

This was probably already discussed earlier with conclusion, at least to me (and I do not ever venture to do it otherwise):

  • if you use Infopath then design any modifications from Infopath Designer, that is, client/local-machine side, not from Sharepoint side.

    • use InfopathDesigner's OOTB features (functionalities), i.e. provided by tools (in this case, Infopath Designer), without overriding their intended/"by design" behavior

      So, if you cannot do something in Infopath template from Infopath Designer, then I prefer calling it a day. And it is not possible to publish a Calculated value control as a sharepoint list column since in Infopath designer this control OOTB doesn't have underlying data field/source (only Xpath expression)

  • do not use sharepoint calulated column in sharepoint lists with attached custom Infopath form templates or calculated value control hoping to have it as sharepoint calculated column. There is nothing in it that you cannot do by other Infopath controls and approaches

if you want to avoid troubles.

Just to add to that discussion that in Infopath:

  • XPath expression (in Infopath) cannot contain special characters (like square brackets, equal sign). Quotes are needed only if the CalcPALID+1 is string (not calculated number). Just leave CalcPALID+1and make sure in the properties of CalcPALID field, that it is one of the numeric Data type: (like Whole number (integer), Decimal (double), etc)
  • field names cannot contain spaces in Infopath.
    BTW, I already had troubles loosing columns (and other entities) due to spaces in their names during migration of Sharepoint servers without any Infopath forms. So, I never have spaces in sharepoint names (in order to use square brackets)

Update:
Was writing before without googling.
So, in a doubt, I decided to google and found a lot of confirmations that was not inventing things as well as workarounds.
For example:

though I simply cannot imagine scenarios/needs which I could not have satisfied without complications of involving of sharepoint Calculated column (again, the main point is: if you use Infopath then don't develop from sharepoint side)

share|improve this answer
    
The formula is the SharePoint GUI formula in the column definition, not the InfoPath formula. The question is about avoiding InfoPath, as far as I understand it, since using an InfoPath calculation would require each record to be opened and saved. –  teylyn Apr 3 '13 at 23:59
    
Infopath form is hard-linked to underlying sharepoint list (columns) through noneditable main data connection source, in case of Sharepoint List Form Infopath type. So, if something cannot be done (or is screwed) from considerations in Infopath Designer, then it is screwed also from Sharepoint side governed by published Infopath template. And vice versa. The phrase: "The question is about avoiding InfoPath...since using an InfoPath calculation" is oxymoron. It is impossible to avoid using Infopath while using Infopath. Either use Infopath or don't but not both –  Gennady Vanin Геннадий Ванин Apr 4 '13 at 2:19
    
You seem to be really passionate about this. I don't see what the problem is. I added a calculated column to a SP 2010 list whose form has been edited with InfoPath 2010. The world is still turning. The calculated column shows correct values for all existing list items without opening a single list item. I can still use the list. I can still edit the IP form. It just works. Maybe I've done something wrong. As long as I don't manipulate the calculated column in InfoPath, I expect things to continue to work. I'll report if they don't. –  teylyn Apr 4 '13 at 9:08
    
what i did was create a data field in infopath and set the default value to the tempid +1 and it works perfectly. –  April Drake Apr 4 '13 at 19:47
    
@ April D, that what I was writing about: 1)doing things from Infopath Designer (avoiding sharepoint side when you use IP template)); 1a)no need to use Calculated column set from sharepoint side for doing the same –  Gennady Vanin Геннадий Ванин Apr 5 '13 at 2:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.