I want to generate a new attribute where the attribute name(s) that has highest value is stored. My goal is similar like this question (Returning the column header of max value on per row basis).
It's quite complicated and involves transposing each example within an example set, sorting to find the maximum, extracting the name of the attribute into a macro and setting this value into the original example set.
Here's a process that you can copy.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.5.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.5.000" expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<parameter key="parallelize_main_process" value="false"/>
<process expanded="true">
<operator activated="true" class="generate_data" compatibility="6.5.000" expanded="true" height="60" name="Generate Data" width="90" x="112" y="75">
<parameter key="target_function" value="random"/>
<parameter key="number_examples" value="100"/>
<parameter key="number_of_attributes" value="5"/>
<parameter key="attributes_lower_bound" value="-10.0"/>
<parameter key="attributes_upper_bound" value="10.0"/>
<parameter key="use_local_random_seed" value="false"/>
<parameter key="local_random_seed" value="1992"/>
<parameter key="datamanagement" value="double_array"/>
</operator>
<operator activated="true" class="generate_attributes" compatibility="6.5.000" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="75">
<list key="function_descriptions">
<parameter key="maximum" value=""unknown""/>
</list>
<parameter key="keep_all" value="true"/>
</operator>
<operator activated="true" class="loop_examples" compatibility="6.5.000" expanded="true" height="76" name="Loop Examples" width="90" x="380" y="75">
<parameter key="iteration_macro" value="example"/>
<parameter key="parallelize_example_process" value="false"/>
<process expanded="true">
<operator activated="true" class="filter_example_range" compatibility="6.5.000" expanded="true" height="76" name="Filter Example Range" width="90" x="112" y="30">
<parameter key="first_example" value="%{example}"/>
<parameter key="last_example" value="%{example}"/>
<parameter key="invert_filter" value="false"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="6.5.000" expanded="true" height="76" name="Select Attributes" width="90" x="112" y="165">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attribute" value=""/>
<parameter key="attributes" value="id|label|maximum"/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="attribute_value"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="time"/>
<parameter key="block_type" value="attribute_block"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="value_matrix_row_start"/>
<parameter key="invert_selection" value="true"/>
<parameter key="include_special_attributes" value="true"/>
</operator>
<operator activated="true" class="transpose" compatibility="6.5.000" expanded="true" height="76" name="Transpose" width="90" x="246" y="165"/>
<operator activated="true" class="sort" compatibility="6.5.000" expanded="true" height="76" name="Sort" width="90" x="380" y="165">
<parameter key="attribute_name" value="att_1"/>
<parameter key="sorting_direction" value="decreasing"/>
</operator>
<operator activated="true" class="extract_macro" compatibility="6.5.000" expanded="true" height="60" name="Extract Macro" width="90" x="514" y="165">
<parameter key="macro" value="max"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="statistics" value="average"/>
<parameter key="attribute_name" value="id"/>
<parameter key="example_index" value="1"/>
<list key="additional_macros"/>
</operator>
<operator activated="true" class="subprocess" compatibility="6.5.000" expanded="true" height="94" name="Subprocess" width="90" x="648" y="30">
<parameter key="parallelize_nested_process" value="false"/>
<process expanded="true">
<connect from_port="in 1" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="source_in 3" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="set_data" compatibility="6.5.000" expanded="true" height="76" name="Set Data" width="90" x="782" y="30">
<parameter key="example_index" value="%{example}"/>
<parameter key="count_backwards" value="false"/>
<parameter key="attribute_name" value="maximum"/>
<parameter key="value" value="%{max}"/>
<list key="additional_values"/>
</operator>
<connect from_port="example set" to_op="Filter Example Range" to_port="example set input"/>
<connect from_op="Filter Example Range" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Filter Example Range" from_port="original" to_op="Subprocess" to_port="in 1"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Transpose" to_port="example set input"/>
<connect from_op="Transpose" from_port="example set output" to_op="Sort" to_port="example set input"/>
<connect from_op="Sort" from_port="example set output" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Subprocess" to_port="in 2"/>
<connect from_op="Subprocess" from_port="out 1" to_op="Set Data" to_port="example set input"/>
<connect from_op="Set Data" from_port="example set output" to_port="example set"/>
<portSpacing port="source_example set" spacing="0"/>
<portSpacing port="sink_example set" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_op="Loop Examples" to_port="example set"/>
<connect from_op="Loop Examples" from_port="example set" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Related
I'm building an automation that reads an excel file with two columns (name and date), stores this to a collection and then sends out calendar invites based on those same parameters.
Extracting the data and sending the invites are both working fine individually but what I need to do now is convert the column that contains the names into email address format e.g. 'Person One' into 'Person.One#emailaddress.com'.
Added to this some of the 'name' rows contain two people in the following format - 'Person One & Person Two' so I'd need to split them into two seperate email addresses so they can both receieve the calendar invite for the appropriate date.
I'm guessing that I should be looking to do this using something in the 'Utility - Strings' function? Can anyone point me in the right direction? Much appreciated, thanks
Rota Example
needs to become
New Collection
There are two major components you'll need to accomplish this conversion of a name to an email address:
Split the initial list of recipients on the & (space-ampersand-space) sequence.
For each of the recipients, calculate the e-mail address by replacing whitespaces with full stop (.) characters and appending the #email.com domain.
As such, your process would look similar to the following:
You can use this in your Blue Prism 6.9 environment by saving the following XML as a .bpprocess or .xml file and importing it using the File > Import > Process / Object menu option in the Blue Prism Interactive Client:
<process name="Test Process" version="1.0" bpversion="6.9.0.26970" narrative="" byrefcollection="true" preferredid="f848bd78-240d-4b87-82b4-ade6ea8e40d8">
<view>
<camerax>0</camerax>
<cameray>-21</cameray>
<zoom version="2">1.25</zoom>
</view>
<preconditions />
<endpoint narrative="" />
<stage stageid="81bc6e0a-2151-4fae-80d7-3ad8d2d9826a" name="Start" type="Start">
<display x="15" y="-105" />
<onsuccess>69469193-4784-4519-bd10-974fb3d7e1da</onsuccess>
</stage>
<stage stageid="b527e78b-915b-4498-bf59-5f662104bb9d" name="End" type="End">
<display x="15" y="165" />
</stage>
<stage stageid="92f4087e-5cdf-41a1-a889-088d7ef7c469" name="Stage1" type="ProcessInfo">
<display x="-195" y="-105" w="150" h="90" />
</stage>
<stage stageid="f9d08d9a-ac87-4c6b-8aa9-2dc864ce8d8d" name="Input" type="Block">
<loginhibit onsuccess="true" />
<display x="-270" y="-45" w="150" h="60" />
<font family="Segoe UI" size="10" style="Regular" color="7FB2E5" />
</stage>
<stage stageid="9fd57578-1b94-43f5-989e-f0fac142744f" name="Recipients" type="Data">
<loginhibit onsuccess="true" />
<display x="-195" y="-15" w="150" h="30" />
<datatype>text</datatype>
<initialvalue xml:space="preserve">Person One</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="5ea9beac-25e7-4560-9253-28706cf4f247" name="Output" type="Block">
<loginhibit onsuccess="true" />
<display x="-270" y="30" w="150" h="90" />
<font family="Segoe UI" size="10" style="Regular" color="7FB2E5" />
</stage>
<stage stageid="71130d29-3d68-4809-809f-11429da8ca1d" name="Recipient Contacts" type="Collection">
<display x="-195" y="75" w="150" h="60" />
<datatype>collection</datatype>
<private />
<alwaysinit />
<collectioninfo>
<field name="Name" type="text" />
<field name="Email" type="text" />
</collectioninfo>
</stage>
<stage stageid="69469193-4784-4519-bd10-974fb3d7e1da" name="Utility - Strings::Split Text" type="Action">
<loginhibit onsuccess="true" />
<display x="15" y="-60" w="120" h="30" />
<inputs>
<input type="text" name="Text to Split" friendlyname="Text to Split" narrative="The text to split" expr="[Recipients]" />
<input type="text" name="Split Char" friendlyname="Split Char" narrative="The split delimiter" expr="" & "" />
<input type="text" name="Collection Field Name" friendlyname="Collection Field Name" narrative="The name of the field for the resulting collection" expr=""Name"" />
</inputs>
<outputs>
<output type="collection" name="Split Values" friendlyname="Split Values" narrative="The resulting collection containing the split values" stage="Split Values" />
</outputs>
<onsuccess>fe157559-e2e0-4a5d-95b7-4681fc9089ce</onsuccess>
<resource object="Utility - Strings" action="Split Text" />
</stage>
<stage stageid="54353e0c-0125-4a3f-9870-8adc655e82a1" name="Split Values" type="Collection">
<display x="165" y="-60" w="90" h="60" />
<datatype>collection</datatype>
<private />
<alwaysinit />
</stage>
<stage stageid="fe157559-e2e0-4a5d-95b7-4681fc9089ce" name="Loop Split Values" type="LoopStart">
<loginhibit onsuccess="true" />
<display x="15" y="-15" w="150" h="30" />
<onsuccess>1f522616-2dbf-4355-97f1-082fa9a00406</onsuccess>
<groupid>31b533a9-c80b-49d2-bba7-2fa7f270cd72</groupid>
<looptype>ForEach</looptype>
<loopdata>Split Values</loopdata>
</stage>
<stage stageid="174f331c-b597-4053-aba2-e65f3f054f7c" name="Loop Split Values" type="LoopEnd">
<loginhibit onsuccess="true" />
<display x="15" y="120" w="150" h="30" />
<onsuccess>b527e78b-915b-4498-bf59-5f662104bb9d</onsuccess>
<groupid>31b533a9-c80b-49d2-bba7-2fa7f270cd72</groupid>
</stage>
<stage stageid="1f522616-2dbf-4355-97f1-082fa9a00406" name="Add Row to Output Collection" type="Action">
<loginhibit onsuccess="true" />
<display x="15" y="30" w="120" h="30" />
<inputs>
<input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr=""Recipient Contacts"" />
</inputs>
<onsuccess>6547bfb9-ae7e-4735-96b4-07fbca2678f0</onsuccess>
<resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" />
</stage>
<stage stageid="6547bfb9-ae7e-4735-96b4-07fbca2678f0" name="Store Name and Calculated Email for Recipient" type="MultipleCalculation">
<loginhibit onsuccess="true" />
<display x="15" y="75" w="120" h="30" />
<onsuccess>174f331c-b597-4053-aba2-e65f3f054f7c</onsuccess>
<steps>
<calculation expression="[Split Values.Name]" stage="Recipient Contacts.Name" />
<calculation expression="Replace([Split Values.Name], " ", ".") & "#email.com"" stage="Recipient Contacts.Email" />
</steps>
</stage>
</process>
I am a beginner in rapidminer. I am working on a project where I need to work on multiple sheets of excel say A and B. There is some data which is present in sheet A, and I have to use this data and perform arithmetic operations on it and some data from sheet B and produce results in sheet B.
I am using read excel operator for fetching excel sheet. And I am using generate attributes to perform arithmetic operations. I found loop operator is used when we are dealing with multiple sheets. But it requires that all the column names of all the sheets should be same. In my case, they are not. So what should I do? How to use multiple sheets when they don't have same column names?
Thanks
The Select Subprocess operator lets you choose a different subprocess based on the value of its select which parameter. Within your Loop operator you are likely to have a macro containing the sheet you are importing. This macro can be used as the parameter for select which. Inside the Select Subprocess operator, the corresponding subprocess will be executed. Obviously, it's up to you to get the contents of each subprocess correct.
There's a small trick with the RapidMiner Read Excel operator that you might not know.
If you don't configure it, but instead just point it at the Excel file you want then it will attempt to import everything from the sheet in sheet number, despite the imported cell range A1.
Use this with the loop operator to bring the data in & store them as individual examplesets in the repository. (You can also use Select Subprocess as Andrew mentioned to perform Generate Attributes just on Sheet1)
Here's an example process.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="7.0.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.0.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="loop" compatibility="7.0.000" expanded="true" height="82" name="Loop" width="90" x="112" y="85">
<parameter key="set_iteration_macro" value="true"/>
<parameter key="macro_name" value="sheetNum"/>
<parameter key="iterations" value="2"/>
<process expanded="true">
<operator activated="true" class="read_excel" compatibility="7.0.000" expanded="true" height="68" name="Read Excel" width="90" x="112" y="85">
<parameter key="excel_file" value="C:\Users\user\myExcel.xlsx"/>
<parameter key="sheet_number" value="%{sheetNum}"/>
<list key="annotations"/>
<list key="data_set_meta_data_information"/>
<description align="center" color="orange" colored="true" width="126">Read each sheetNum. Note this operator is not configured with attribute names it reads these from the Excel doc.</description>
</operator>
<operator activated="true" class="store" compatibility="7.0.000" expanded="true" height="68" name="Store" width="90" x="313" y="85">
<parameter key="repository_entry" value="//Local Repository/data/myExcel_sheet%{sheetNum}"/>
<description align="center" color="orange" colored="true" width="126">Store each sheetNum as a separate ExampleSet in the repository.</description>
</operator>
<connect from_op="Read Excel" from_port="output" to_op="Store" to_port="input"/>
<connect from_op="Store" from_port="through" to_port="output 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
</process>
<description align="center" color="orange" colored="true" width="126">Loop 2 times for each sheetNum</description>
</operator>
<connect from_op="Loop" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
I have a dataset with 3 class positive, neutral and negative.
I try to create a classifier using SVM.
my dataset:
my code in rapidminer:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<parameter key="parallelize_main_process" value="true"/>
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="5.3.015" expanded="true" height="60" name="Retrieve sentim20k" width="90" x="45" y="210">
<parameter key="repository_entry" value="//Local Repository/diploamitki/new/sentim20k"/>
</operator>
<operator activated="true" class="x_validation" compatibility="5.1.002" expanded="true" height="112" name="Validation" width="90" x="447" y="165">
<description>A cross-validation evaluating a decision tree model.</description>
<parameter key="parallelize_training" value="true"/>
<parameter key="parallelize_testing" value="true"/>
<process expanded="true">
<operator activated="true" class="support_vector_machine" compatibility="5.3.015" expanded="true" height="112" name="SVM" width="90" x="112" y="30"/>
<connect from_port="training" to_op="SVM" to_port="training set"/>
<connect from_op="SVM" from_port="model" to_port="model"/>
<portSpacing port="source_training" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
<portSpacing port="sink_through 1" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance" width="90" x="345" y="30"/>
<connect from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
<connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
<portSpacing port="source_model" spacing="0"/>
<portSpacing port="source_test set" spacing="0"/>
<portSpacing port="source_through 1" spacing="0"/>
<portSpacing port="sink_averagable 1" spacing="0"/>
<portSpacing port="sink_averagable 2" spacing="0"/>
</process>
</operator>
<connect from_op="Retrieve sentim20k" from_port="output" to_op="Validation" to_port="training"/>
<connect from_op="Validation" from_port="averagable 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
I have this error:
I know SVM can handle 2 class but how can I create model with tis dataset?
I found a solution. I used the operator "Polynominal by Bionominal Classification".
This operator training a model with 3 class using SVM.
here an example:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="5.3.015" expanded="true" height="60" name="Retrieve sentim20k" width="90" x="45" y="120">
<parameter key="repository_entry" value="//Local Repository/diploamitki/new/sentim20k"/>
</operator>
<operator activated="true" class="polynomial_by_binomial_classification" compatibility="5.3.015" expanded="true" height="76" name="Polynomial by Binomial Classification" width="90" x="246" y="75">
<parameter key="classification_strategies" value="1 against 1"/>
<process expanded="true">
<operator activated="true" class="x_validation" compatibility="5.1.002" expanded="true" name="Validation">
<description>A cross-validation evaluating a decision tree model.</description>
<parameter key="leave_one_out" value="true"/>
<process expanded="true">
<operator activated="true" class="support_vector_machine_libsvm" compatibility="5.3.015" expanded="true" name="SVM">
<list key="class_weights"/>
</operator>
<connect from_port="training" to_op="SVM" to_port="training set"/>
<connect from_op="SVM" from_port="model" to_port="model"/>
<portSpacing port="source_training" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
<portSpacing port="sink_through 1" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" name="Apply Model">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance" compatibility="5.3.015" expanded="true" name="Performance"/>
<connect from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
<connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
<portSpacing port="source_model" spacing="0"/>
<portSpacing port="source_test set" spacing="0"/>
<portSpacing port="source_through 1" spacing="0"/>
<portSpacing port="sink_averagable 1" spacing="0"/>
<portSpacing port="sink_averagable 2" spacing="0"/>
</process>
</operator>
<connect from_port="training set" to_op="Validation" to_port="training"/>
<connect from_op="Validation" from_port="model" to_port="model"/>
<portSpacing port="source_training set" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
</process>
</operator>
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (2)" width="90" x="380" y="120">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance (3)" width="90" x="514" y="30"/>
<connect from_op="Retrieve sentim20k" from_port="output" to_op="Polynomial by Binomial Classification" to_port="training set"/>
<connect from_op="Polynomial by Binomial Classification" from_port="model" to_op="Apply Model (2)" to_port="model"/>
<connect from_op="Polynomial by Binomial Classification" from_port="example set" to_op="Apply Model (2)" to_port="unlabelled data"/>
<connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (3)" to_port="labelled data"/>
<connect from_op="Performance (3)" from_port="performance" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
I would like to have a view that show attributes from 3 entities:
Statistics has a lookup to Account and Account has a lookup to Address.
The view is on Statistics and I want attributes from all 3 entities; is this even possible?
The problem is with the GridXML.
I want to include the attribute wl_city in the GridXML.
This is the FetchXML with link-entities:
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical">
<entity name="sb_statistics">
<order attribute="sb_amount" descending="false" />
<!-- It is easy to get these into the GridXML -->
<attribute name="sb_debtor" />
<attribute name="sb_date" />
<attribute name="sb_amount" />
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<!-- It is possible to get this into the GridXML
by using the link-entity alias: relatedAccount.wl_towncity -->
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
<!-- I have trouble getting this attribute into the GridXML -->
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
</fetch>
</fetchxml>
When I change the GridXML as below this error is displayed when the view is opened:
"To use this saved query, you must remove criteria and columns that refer to deleted or non-searchable items"
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAccount.relatedAddress.wl_city" width="100" />
</row>
</grid>
</layoutxml>
The below GridXML shows this error when the view is opened:
"Unexpected Error An error has occured".
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAddress.wl_city" width="100" />
</row>
</grid>
</layoutxml>
The GridXML below results in this error being shown when the view is opened:
"To use this saved view, you must remove criteria and columns that refer to deleted or non-searchable columns".
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="wl_city" width="100" />
</row>
</grid>
</layoutxml>
This saved query works, but it only includes attributes from the primary entity and the first link-entity.
<savedquery>
<IsCustomizable>1</IsCustomizable>
<CanBeDeleted>0</CanBeDeleted>
<isquickfindquery>0</isquickfindquery>
<isprivate>0</isprivate>
<isdefault>0</isdefault>
<returnedtypecode>10008</returnedtypecode>
<savedqueryid>{df101ac4-2e4d-e311-9377-005056bd0001}</savedqueryid>
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAccount.wl_city" width="100" />
</row>
</grid>
</layoutxml>
<querytype>0</querytype>
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical">
<entity name="sb_statistics">
<order attribute="sb_amount" descending="false" />
<attribute name="sb_debtor" />
<attribute name="sb_date" />
<attribute name="sb_amount" />
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
</fetch>
</fetchxml>
<LocalizedNames>
<LocalizedName description="Statistics and Address" languagecode="1033" />
</LocalizedNames>
</savedquery>
Is GridXML limited to showing only attributes from the primary entity and the first link-entity?
This is not possible, according to the best of my knowledge, but please someone prove me wrong.
A limitation of GridXML appears to be that attributes can only be included that are from the first link-entity, not any nested link-entities.
It should work when using link-type="inner" for nested link.
<entity name="sb_statistics">
...
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="inner"> //link-type="inner"
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
I have found no evidence that it can be done. With or without link-type='inner' the designer (in 2013) says, "The relatedAddress.wl_city column is no longer a valid column because it has been deleted as a column option. You need to remove this column and, if you want, add a different one."
It does NOT need multiple dereferrences, nor does that work. If you dump the keyValuePairs of the AttributeCollection returned by the fetch, you will see the key is relatedAddress.w1_city -- not its parent nor the combination.
Like the UI, it just appears the layout is limited to only root and children, no grandchildren nor further descendants.
I think it's a little late to answer this question, but maybe someone come to this post and find it helpful.
first thing you should know is that, fetchxml will return only column that are not null, so if you are querying a column that there is no data in that, then fetchxml automatically remove it from result set.
second thing is, if you have different table with different relationship, then alias name will be added to the column name, so in your case relatedAccount.wl_towncity and relatedAddress.wl_city is correct and not relatedAccount.relatedAddress.wl_city. in your example, you put alias name after each other that is not correct.
third thing that you should know is that when a nested result will return, the type is object, but original type AliasedValue , so first you have to cast the object to AliasedValue. then it become ready to cast it to OptionSetValue. after that you have to look for .Value that has the result of what you want
I made it work like this: I still have an issue with unresolved columnheaders.
<fetch distinct='true'>
<entity name='rdiac_riskobject'>
<attribute name='rdiac_riskobjectid' />
<attribute name='rdiac_name' />
<attribute name='rdiac_riskobjectproduct' />
<link-entity name='rdiac_riskobject_rdiac_propertydetail' from='rdiac_riskobjectid' to='rdiac_riskobjectid' intersect='true'>
<link-entity name='rdiac_propertydetail' alias='pd1' from='rdiac_propertydetailid' to='rdiac_propertydetailid'>
<attribute name='rdiac_valuestring' />
<link-entity name='rdiac_propertysvconfig' from='rdiac_property' to='rdiac_propertyid'>
<filter>
<condition attribute='rdiac_svfield' operator='eq' value='100000000'/>
</filter>
</link-entity>
</link-entity>
</link-entity>
<link-entity name='rdiac_riskobject_rdiac_propertydetail' from='rdiac_riskobjectid' to='rdiac_riskobjectid' intersect='true'>
<link-entity name='rdiac_propertydetail' alias='pd2' from='rdiac_propertydetailid' to='rdiac_propertydetailid'>
<attribute name='rdiac_valuestring' />
<link-entity name='rdiac_propertysvconfig' from='rdiac_property' to='rdiac_propertyid'>
<filter>
<condition attribute='rdiac_svfield' operator='eq' value='100000001'/>
</filter>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>
<grid name='resultset' object='10139' jump='rdiac_riskobjectproduct' select='1' preview='0' icon='1' >
<row name='result' id='rdiac_riskobjectid' >
<cell name='rdiac_riskobjectproduct' width='100' />
<cell name='pd1.rdiac_valuestring' width='200' />
<cell name='pd2.rdiac_valuestring' width='200' />
</row>
</grid>
I tried different ways to set the width for my gridview clumns but nothing worked out for me. Can some one guide me about how o achieve ths. i am including my code below...
Thanks.
<SharePoint:SPGridView ID="gvSearchResults" EnableViewState="true" runat="server"
AlternatingRowStyle-BackColor="#f4f8fd" AllowSorting="true" DataKeyNames="ID"
AutoGenerateColumns="false" OnSorting="gvxxxResults_Sorting" OnPageIndexChanging="gvxxxResults_PageIndexChanging">
<Columns>
<asp:HyperLinkField HeaderText="Name" DataTextField="FileLeafRef"
DataNavigateUrlFields="FileLeafRef" Target="_parent" DataNavigateUrlFormatString="/pp/ll/lp/llDocs/{0}"
ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false"
SortExpression="Name" ItemStyle-Width="50px" />
<asp:BoundField DataField="Home_x0020_Number" HeaderText="Home Number" NullDisplayText=" " SortExpression="Home_x0020_Number">
<HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
<ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Phone_x0020_Number" HeaderText="Phone Number" NullDisplayText=" " SortExpression="Phone_x0020_Number">
<HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
<ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
</asp:BoundField>
</Columns>
</SharePoint:SPGridView>
Have you tried using the SPBoundField control instead? Try setting the SPBoundField.ControlStyle.Width property.