Skip to main content

How to calculate an existing attribute value to NULL

Comments

10 comments

  • Permanently deleted user
    Hi Michael,

     

    You could try to use InvokeMethod activity and set TargetType to (null) …it is already default value. TargetObject would be your collection of attributes (for you theQueryResult.Features(0).Attributes ). MethodName = Remove

     

    In Parameters collection add a row with :

     

    Direction = In

     

    Type = String

     

    Value = "brief_description"

     

    This should remove any attribution that the featuresSet gives to the attribute (not set the attributes) so DB and other part of the code should see it as null.

     

    Let us know if that works for you

     

     
    0
  • John Nerge
    I have been using the same Assign method and using nothing (all lower case) as the assigned value to successfully calculate field values to <Null>.

     

    I honestly don't know if the casing of the word matters, but I thought I should mention it anyway since it is working for me.
    0
  • Permanently deleted user
    Francesca,

     

    Thanks for the suggestion.  I think I got everything right syntax wise with the Invoke method, but it still did NOT work.  Here is my syntax with just this activity: <Activity mc:Ignorable="sap sap2010 sads" x:Class="ActivityBuilder" mva:VisualBasic.Settings="{x:Null}" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client" xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client" xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client" xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi" xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting" xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=System.Core" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=mscorlib" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <TextExpression.NamespacesForImplementation> <sco:Collection x:TypeArguments="x:String"> <x:String>System.Activities</x:String> <x:String>System.Activities.Statements</x:String> <x:String>System.Activities.Expressions</x:String> <x:String>System.Activities.Validation</x:String> <x:String>System.Activities.XamlIntegration</x:String> <x:String>ESRI.ArcGIS.Client</x:String> <x:String>ESRI.ArcGIS.Client.Geometry</x:String> <x:String>ESRI.ArcGIS.Client.Tasks</x:String> <x:String>Geocortex.Core.Extensions</x:String> <x:String>Geocortex.Workflow.Activities</x:String> <x:String>Geocortex.Forms.Client</x:String> <x:String>Geocortex.Forms.Client.Items</x:String> <x:String>Geocortex.Reporting</x:String> <x:String>System</x:String> <x:String>Microsoft.VisualBasic.Activities</x:String> <x:String>System.Collections.Generic</x:String> <x:String>System.Linq</x:String> <x:String>System.Windows.Markup</x:String> </sco:Collection> </TextExpression.NamespacesForImplementation> <TextExpression.ReferencesForImplementation> <sco:Collection x:TypeArguments="AssemblyReference"> <AssemblyReference>System.Activities</AssemblyReference> <AssemblyReference>ESRI.ArcGIS.Client</AssemblyReference> <AssemblyReference>Geocortex.Core</AssemblyReference> <AssemblyReference>Geocortex.Workflow</AssemblyReference> <AssemblyReference>Geocortex.EssentialsWpfApi</AssemblyReference> <AssemblyReference>Geocortex.Reporting</AssemblyReference> <AssemblyReference>System.Core</AssemblyReference> <AssemblyReference>System</AssemblyReference> <AssemblyReference>mscorlib</AssemblyReference> <AssemblyReference>PresentationFramework</AssemblyReference> <AssemblyReference>WindowsBase</AssemblyReference> <AssemblyReference>PresentationCore</AssemblyReference> <AssemblyReference>System.Xaml</AssemblyReference> </sco:Collection> </TextExpression.ReferencesForImplementation> <Sequence mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces"> <InvokeMethod MethodName="Remove"> <InvokeMethod.TargetObject> <InArgument x:TypeArguments="scg:IDictionary(x:String, x:Object)">[queryResultFS.Features(0).Attributes]</InArgument> </InvokeMethod.TargetObject> <InArgument x:TypeArguments="x:String">zoning</InArgument> <sap2010:WorkflowViewState.IdRef>InvokeMethod_1</sap2010:WorkflowViewState.IdRef> </InvokeMethod> <sap2010:WorkflowViewState.IdRef>Sequence_1</sap2010:WorkflowViewState.IdRef> <sads:DebugSymbol.Symbol>dyNDOlx0ZW1wXEludm9rZU1ldGhvZFBhcmFtZXRlcnMueGFtbAQ/A0kOAgEBQAVGFAIBAkQuRDQCAQRCS0JxAgED</sads:DebugSymbol.Symbol> </Sequence> <sap2010:WorkflowViewState.IdRef>ActivityBuilder_1</sap2010:WorkflowViewState.IdRef> <sap2010:WorkflowViewState.ViewStateManager> <sap2010:ViewStateManager> <sap2010:ViewStateData Id="InvokeMethod_1" sap:VirtualizedContainerService.HintSize="217.6,134.4" /> <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="240,259.2"> <sap:WorkflowViewStateService.ViewState> <scg:Dictionary x:TypeArguments="x:String, x:Object"> <x:Boolean x:Key="IsExpanded">True</x:Boolean> </scg:Dictionary> </sap:WorkflowViewStateService.ViewState> </sap2010:ViewStateData> <sap2010:ViewStateData Id="ActivityBuilder_1" sap:VirtualizedContainerService.HintSize="280,339.2" /> </sap2010:ViewStateManager> </sap2010:WorkflowViewState.ViewStateManager> </Activity> Any other ideas?

     

    Michael
    0
  • Permanently deleted user
    John,

     

    Thanks for making the suggestion.  I tried "nothing" instead of "Nothing," but this, again, did not change the value in the field to NULL.  This, as before, really did nothing.
    0
  • John Nerge
    Follow up question: what type of feature class are you trying to update? I'm using enterprise gdb feature classes stored in SQL Server 2012 in my case.
    0
  • Permanently deleted user
    John,

     

    We are a bit behind you, but similar.  I am trying to update an enterprise gdb point feature class stored in SQL Server 2008 R2.
    0
  • Permanently deleted user
    Hi Michael,

     

    Both workflows above look correct to me but unfortunately it wouldn't be meaningful run them as we are using Oracle DB. I would double check DB and feature service settings for that attribute to be sure that the problem is not there. Maybe you can try to set to null another string attribute, or another type of attribute to narrow down the problem (workflow or attribute setting)

     

    Sorry, not very helpful …
    0
  • Permanently deleted user
    Thanks for responding Francesca!

     

    Just to be clear, are you saying that the workflows I have presented above are expected to calculate a NULL value in the appropriate field?  (Even in Oracle?).

     

    Michael
    0
  • Permanently deleted user
    They look formally correct to me. The activity in first workflow is what I normally use to set a property to null. Not 100% sure about 2 activities below

     

    User-added image

     

    The "nothing" one looks better but because it is assigned to a string attribute that could be the problem. I never used DBNull.Value in a workflow but I know that is the null representation for VB ...

     

    To think a bit outside the box: did you try to run the update feature from the Map service's REST end point and set the null value? ... Just trying to understand if the problem is in the workflow or it is a map service/DB level...
    0
  • Permanently deleted user
    I'm facing the same issue - trying to set a null value in a DB table field of number type with null values allowed. If the field is a string, Nothing works; if it's a number, it does not work and I can see in our server logs that the edit was rejected based on the wrong type. I've tried null, <null>, String.Null, "", always wrong type - can someone suggest how to set an integer null using an assing activity?
    0

Please sign in to leave a comment.