Skip to main content
Nov 9, 2021 8:24 AM UTC
Solved

Clear data on Origin Forms

Does anyone have a piece of code to clear data on the origin Forms member for just a few accounts? The api.data.clearcalculateddata is not possible (data is not calculated) and api.data.setdatacell doesn't work. Thanks. 

ChristianW
Employee - Advisor
Nov 9, 2021 9:38 AM UTC

You can combine calculate with clearcalculateddate like this:

Dim script as string = pov

api.data.calculate($"{script} = 0 * {script}")

api.data.clearcalculateddata(script)

The first row will make it calculated, the second row will delete it, because now it is calculated.

9 replies

ChristianW
Employee - Advisor
Employee - Advisor
Nov 9, 2021 9:38 AM UTC

You can combine calculate with clearcalculateddate like this:

Dim script as string = pov

api.data.calculate($"{script} = 0 * {script}")

api.data.clearcalculateddata(script)

The first row will make it calculated, the second row will delete it, because now it is calculated.

Nov 22, 2021 10:28 PM UTC

I've tried this, but I'm not following how to do this.  I have several accounts where I only want to clear the Forms data.  

 

I need the forms data cleared for all the accounts where Text 8 Startswith VarPercentofSales

This was the code I tried:

 

Dim script As String = "A#All:F#EndBal_Input:V#Periodic:O#Forms:U1#Local_Input:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None.Where(Text8 Startswith VarPercentofSales)"

api.data.calculate($"{script} = 0 * {script}")

api.data.ClearCalculatedData("TRUE","TRUE","TRUE","TRUE","A#IncStmnt.Base.Where(Text8 Startswith VarPercentofSales)",,"O#Forms",,,,,,,,,)

 

ChristianW
Employee - Advisor
Employee - Advisor
Nov 25, 2021 4:50 PM UTC

The script and the syntax is not correct, try this:

Dim script As String = "A#All"

api.data.calculate($"{script} = 0 * {script}","A#IncStmnt.Base.Where(Text8 Startswith VarPercentofSales)",,"O#Forms")
api.data.ClearCalculatedData(True,True,True,True,"A#IncStmnt.Base.Where(Text8 Startswith VarPercentofSales)",,"O#Forms")

 

RobAuthor
Nov 9, 2021 10:05 AM UTC

Thanks Christian, tested this and works as expected. 

Employee - Mentor
Nov 19, 2021 1:28 PM UTC

Can also use the below where amount is 0.0 and isNoData is True.

api.Data.SetDataCell(memberScript, amount, isNoData, isDurableCalculatedData)

Member
Aug 20, 2026 1:33 PM UTC

hey ​@EricOsmanski , I have tested this 4y later, and it only works if you have data in origin Import, otherwise no