Score:-2

Read view field value in VBO action

in flag

I have a view grid that has custom actions to perform based on selected grid row. To read the view fields from the grid dpm-ed the below command:

dpm($this->view->result);

The above command returns:

enter image description here

I am trying to specifically read the "field_comment_id_comment_field_data_nid" and I get null every time:

 dpm($this->view->result[0]->field_comment_id_comment_field_data_nid);

Update: I modified the dpm and I see the value correctly. Unsure of how to loop through the result array. still trying.

cn flag
`ResultRow` doesn’t have a `get` method. The output says `field_comment_id_comment_field_data_nid` is a public property of the object so you can access it directly
in flag
I tried the below code: dpm($this->view->result->field_comment_id_comment_field_data_nid->Value) to read the value directly and I get null
cn flag
You need to pay a bit more attention to the debug output - `$this->view->result` is an array
in flag
can i get some more help? I'm still seeing null on my end :( newbie here..
Score:0
in flag

Alright. Below solution works:

foreach($this->view->result as $result)
  dpm($result->field_comment_id_comment_field_data_nid);
}

thanks @clive for pointing on the array thing.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.