Question

Transfer a row from translation log to attribute table


Badge

Hi!

In the translation log, i have tried to add a specific row (in my case row 85) to attribute table without any result. Is this possible to do it? The pythoncaller script (Esri Arcgis Python 3.7) look like this:

 

import fme

import fmeobjects

from arcgis.gis import GIS

from arcgis.apps.storymap.story import StoryMap

from arcgis.apps.storymap.story_content import Image, TextStyles, Video, Audio, Embed, Map, Text, Button, Gallery, Swipe, Sidecar, Timeline

from arcgis.gis import Item

from arcgis.apps.storymap import Themes

 

class FeatureProcessor(object):

  def __init__(self):

    pass

  def input(self, feature):

    gis = GIS("home")

    new_story = StoryMap("9f1567e92c514baabdc2e595776bfdc8")

    new_story

    new_story.nodes

    newFeature = fmeobjects.FMEFeature()

    self.pyoutput(newFeature)

    print(new_story.nodes)

  def close(self):

    pass

  def process_group(self):

    pass

 

arcgis package 2.0.0 in ArcGIS Pro needed to run this script. A similar script without arcgis package 2.0.0 work fine,

 

Thank you for your assistance!

 

image


2 replies

Userlevel 1
Badge +21

If you want to have the output as text in an attribute rather than the log file you will need to set the attribute before outputting the feature

It looks like the output (new_story.nodes) is a dictionary, so you will also need to convert before you'll be able to set as an attribute. You can do this by importing the json module and then doing something like

newFeature.setAttribute("nodeid",json.dumps(new_story.nodes))

 

 

Badge

I modified it to newFeature.setAttribute("nodeid",str(new_story.nodes)), and it worked perfectly. Thank you!

 

Reply