1

In GoodData project is possible to move your attributes and facts to some specific folder. I'm trying to do something like that by Ruby script. I have project blueprint and a list of attribute ids and information about their folders, but I'm still not sure how to change a folder. Because this code doesn't work:

    blueprint = project.blueprint
    blueprint.datasets.map do |dataset|
    dataset.attributes.map do |attr|
        attr.folder = dataset.title
    end
   end

Error:

NoMethodError: undefined method `folder='

In GoodData Ruby Cookbook is example how to find list of folders, but no more information.

 # Currently there is not support in SDK to directly explore folders but we can reach to API directly
  # You can also go to the project in your browser and look for folders there
  client.get("#{project.md['query']}/dimensions")['query']['entries'].map {|i| i['title']} # => ["Dataset.Opportunities", "Awesome Sales Reps", "Dataset.Regions"]

  client.get("#{project.md['query']}/folders")['query']['entries'].map {|i| i['title']} # => ["My Special Folder"]

Has somebody already tried to change folder of attributes or facts in your GoodData project?

here is SDK: http://www.rubydoc.info/gems/gooddata/GoodData/Model/BlueprintField and here are some examples how to work with a blueprint, but mostly it's just about creating new attributes: http://sdk.gooddata.com/gooddata-ruby-examples/#_12_working_with_blueprints

Thank you for any idea. Michal

4

1 回答 1

0

GoodData 自动化 SDK 不支持更改属性或事实文件夹。

您可以做的是通过 CloudConnect、MAQL 更改它,或者您可以在 Ruby 中开发自己的方法,当然也可以通过 UI 更改它。

CloudConnect 允许您对其进行更改,还可以向您显示将用于更改的 MAQL 代码。您可以从中学习如何为此类更改创建 MAQL 代码,然后您可以通过 GoodData API 执行 MAQL 代码。此处描述了如何通过 API 执行 MAQL 代码:https ://developer.gooddata.com/api#/reference/project-model/execute-a-maql-ddl-script/execute-a-maql-ddl-script

也可以通过 UI 更改它,通过浏览器开发工具捕获更改(它是 HTTP POST 到属性/事实对象)并通过 Ruby 重现 POST。

于 2016-02-17T13:47:36.633 回答