<div dir="ltr">Nancy, I tend to do the following (using body as an example) in pseudo standard data import script.<div><br></div><div><div>$body = $wrapper->body->value();</div><div>if (empty($body)) {</div><div> // Do something, for example set a value to avoid Undefined variable notices</div>
<div> $wrapper->body->set(array('value' => ''));</div><div>}</div><div>// Now I can deal with the data as if it were populated.</div><div>if ($wrapper->body->value->raw() != $this->Body) {</div>
<div> $wrapper->body->set(array('value' => $this->Body, 'format' => 'full_html'));</div><div>}</div></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div><br>
</div>Lucas<div><a href="http://www.mtechinformationsolutions.com" target="_blank">MTech, LLC</a></div></div></div>
<br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 12:25 PM, Nancy Wichmann <span dir="ltr"><<a href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif"><div><span>With fields I often do:</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span><span style="font-family:Courier New,courier,monaco,monospace,sans-serif"> if ($vca = field_get_items('node', $node, 'field_corresponding_vca')) {<br></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:Courier New,courier,monaco,monospace,sans-serif">
<span><span style="font-family:arial,helvetica,sans-serif"><br></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif"><span><span style="font-family:arial,helvetica,sans-serif">This </span>makes sure
there is some data before trying to do anything with it.</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br><span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span>But I've searched all over the place and even dug into the code. How do you do this with entity_metadata_wrapper? I want to give the users an error message that means something to them, and sometimes just set the value to zero.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br><span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span>I see that the Entity module
has a protected function called "dataAvailable" but I can't use a protected function.<br></span></div><div> </div><div><font color="#ff007f" face="bookman old style, new york, times, serif" size="4"><i><b>Nancy</b></i></font> <br>
</div><div><font face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</font></div></div></div><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br></div>