diff --git a/Post/PView.cpp b/Post/PView.cpp
index 3c23f24029a609b35fd3ec4dc4995fdce8cc6d2d..247517a32e9fe7037cbefcf1e2af4cf23ee5dbf5 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -98,8 +98,18 @@ PView::PView(std::string name, std::string type,
              double time)
 {
   _init();
-  PViewDataGModel *d = new PViewDataGModel
-    ((type == "NodeData") ? PViewDataGModel::NodeData : PViewDataGModel::ElementData);
+  PViewDataGModel::DataType t;
+  if(type == "NodeData")
+    t = PViewDataGModel::NodeData;
+  else if(type == "ElementData")
+    t = PViewDataGModel::ElementData;
+  else if(type == "ElementNodeData")
+    t = PViewDataGModel::ElementNodeData;
+  else{
+    Msg::Error("Unknown type of view to create '%s'", type.c_str());
+    return;
+  }
+  PViewDataGModel *d = new PViewDataGModel(t);
   d->addData(model, data, 0, time, 1);
   d->setName(name);
   d->setFileName(name + ".msh");