Question about adding a field value to a view programmatically I am having a problem getting a field to print and know it is something I am missing. I am trying to print a product field in a view that is created programmatically. Everything else is working fine, but I cannot pull the item size in to the view. here is the code:

 $form['assigned'] = array(
'#type' =&gt; 'fieldset',
'#title' =&gt; t('Assigned orders'),
'#tree' =&gt; TRUE,
'#collapsible' =&gt; TRUE,
'#collapsed' =&gt; FALSE,
);
$orders = views_get_view('get_drivers_orders');
$orders-&gt;set_display('default');
$orders-&gt;set_arguments(array('0' =&gt; $account-&gt;uid));
// change the amount of items to show
$orders-&gt;pre_execute();
$orders-&gt;execute();
$orders-&gt;render();
if ($orders-&gt;result) {
foreach ($orders-&gt;result as $key =&gt; $value) {
  $order = uc_order_load($value-&gt;field_driver_id_users_order_id);
  $form['assigned'][$key] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Order #' . $value-&gt;field_driver_id_users_order_id),
    '#tree' =&gt; TRUE,
    '#collapsible' =&gt; TRUE,
    '#collapsed' =&gt; TRUE,
  );
  $form['assigned'][$key]['view'] = array(
    '#markup' =&gt; l('View order', 'user/' . $account-&gt;uid . '/delivery/' . $order-&gt;order_id),
  );
  foreach ($order-&gt;products as $product_id =&gt; $product) {
    $form['assigned'][$key][$product_id]['attribute'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t($product-&gt;title),
      '#markup' =&gt; isset($product-&gt;data['attributes']['What would you like']) ? $product-&gt;data['attributes']['What would you like'][0] : '',
    );
    $form['assigned'][$key][$product_id]['size'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t('Size:'),
      '#markup' =&gt; isset($product-&gt;data['size']) ? $product-&gt;data['size'][und][0]['value'] : '', 
    );
  }
  $address = uc_custom_process_get_order_address($order);
  $form['assigned'][$key]['map'] = array(
    '#markup' =&gt; l('View map','http://www.google.com/maps?q='.$address.'(tooltip/infowindow title)',array('attributes' =&gt; array('target'=&gt;'_blank'))),
  );
  $form['assigned'][$key]['total'] = array(
    '#type' =&gt; 'item',
    '#title' =&gt; t('Total:'),
    '#markup' =&gt; '$' . $order-&gt;order_total,
  );
}


Here is an image of the krumo of the the view with the products, I do hope someone can help!
    }

I have looked over the proposed solution and it does not fit my use case. I have a view that shows an individual order, that order has products, and those products have all of there values stored in $product->data. I have tried everything to get information from the 'size' field to display in that view and it is not happening. I am not trying to change a value, just display it! I hope this helps everyone help me! :D
So the issues was that Krumo pulled that information of its own accord, and the $order object did not have those details. I had to call $product->nid first, query the DB for the field values i needed, and insert them. I ended up with this code, in case it can help anyone! 

    foreach ($order-&gt;products as $product_id =&gt; $product) {
    $pid = $product-&gt;nid;
    $ps = db_query('SELECT field_size_value FROM field_data_field_size WHERE entity_id = :pid', array(':pid'=&gt;$pid))-&gt;fetchField();
    $pp = db_query('SELECT field_pack_value FROM field_data_field_pack WHERE entity_id = :pid', array(':pid'=&gt;$pid))-&gt;fetchField();
    $form['assigned'][$key][$product_id]['attribute'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t($product-&gt;title),
      '#markup' =&gt; isset($product-&gt;data['attributes']['What would you like']) ? $product-&gt;data['attributes']['What would you like'][0] : '',
    );
    if(!empty($ps)){
        $form['assigned'][$key][$product_id]['size'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t('Size:'),
      '#markup' =&gt; $ps, 
    );
    }
    if(!empty($pp)){
      $form['assigned'][$key][$product_id]['pack'] = array(
        '#type' =&gt; 'item',
        '#title' =&gt; t('Pack:'),
        '#markup' =&gt; $pp, 
      );
    }
  }