pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
987 stars 665 forks source link

The formula contains a syntax error or is not supported. #1288

Open sudheermadduru opened 6 years ago

sudheermadduru commented 6 years ago

Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

The formula contains a syntax error or is not supported.

Expected behavior

Should be able to create calculated column using PnP Powershell

Actual behavior

Add-PnPFieldFromXml: The formula contains a syntax error or is not supported.

Steps to reproduce behavior

I am using below formula and able to through browser in the calculated.

=IF(Nom="";"";Nom&" ")&Prenom&IF(Fonction="";"";", "&Fonction)&IF(Entity="";"";", "&Entity)

All the fields and result type is of type text

Below is the format that is being used to create calculated column using PnP Powershell

$string='=IF(Nom="";"";Nom&" ")&Prenom&IF(Fonction="";"";", "&Fonction)&IF(Entity="";"";", "&Entity)=IF(Nom="";"";Nom&" ")&Prenom&IF(Fonction="";"";", "&Fonction)&IF(Entity="";"";", "&Entity)'

Add-PnPFieldFromXml -List "listname" -FieldXml $string

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)

How did you install the PnP-PowerShell Cmdlets?

e-gallis commented 6 years ago

I've been facing the same problem for month now. In 2017, the problem existed already. Now we're in july 2018 and it's still there. Sorry to be a bit rude but I always have columns with formulas which I cannot provision using PNP. This is becoming really annoying... The only solution I found for now is that I created a script that:

maxali commented 5 years ago

Have you tried using <FieldRef /> property in your ` node?

<Field .... >
    <Formula>=YEAR({Due Date})</Formula>
    <FieldRefs>
        <FieldRef Name="MyDueDate" ID="{GUID MyDueDate}"/>
    </FieldRefs>    
</Field>
futsch87 commented 5 years ago

Hi, I have the same problem with calculated columns. A workaround seems to be to replace all semicolons in the formula by commas.

Can you please check this workaround?