diff --git a/entity/ActivityLink_entity/recordcontainers/db/conditionProcess.js b/entity/ActivityLink_entity/recordcontainers/db/conditionProcess.js
index 88680ac2a07f72a65cbfec3b9df2d5255b9e79c3..174ad7f6d1a52dda34c6476bf86ec19f02b242a2 100644
--- a/entity/ActivityLink_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/ActivityLink_entity/recordcontainers/db/conditionProcess.js
@@ -3,7 +3,7 @@ import("system.db");
 import("system.result");
 import("Sql_lib");
 
-var cond = newWhere("ACTIVITYLINK.ACTIVITY_ID", "$param.ActivityId_param");
+var cond = newWhereIfSet("ACTIVITYLINK.ACTIVITY_ID", "$param.ActivityId_param");
 
 //TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
 result.string(cond.toString());
\ No newline at end of file
diff --git a/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js b/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js
index bc4bb6f2e23a0d181ef6cb5800e3016df906a42d..ba9d5cc9a90c1fb75ef9a9c1a675d99702e56e5a 100644
--- a/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js
@@ -10,7 +10,10 @@ if (vars.get("$param.OnlyActives_param") == "true")
     cond.and("AB_KEYWORD_ENTRY.ISACTIVE", "1");
 }
 
-cond.andIfSet("AB_KEYWORD_ENTRY.KEYID", newWhere(vars.get("$param.ExcludedKeyIdsSubquery_param")), SqlBuilder.NOT_IN())
+if (vars.get("$param.ExcludedKeyIdsSubquery_param"))
+{
+    cond.and("AB_KEYWORD_ENTRY.KEYID not in ( " + vars.get("$param.ExcludedKeyIdsSubquery_param") + ")");
+}
 
 if (vars.getString("$param.WhitelistIds_param"))
     cond.and("AB_KEYWORD_ENTRY.KEYID", JSON.parse(vars.getString("$param.WhitelistIds_param")), SqlBuilder.IN());
diff --git a/entity/ObjectRelationType_entity/entityfields/removeactiongroup/children/removeusage/onActionProcess.js b/entity/ObjectRelationType_entity/entityfields/removeactiongroup/children/removeusage/onActionProcess.js
index 7de1f5f6cb2dc53d15d82fdf758c2dd93880f2a6..95f3d3d8c2eb9ce2a53f90ef533c0c24aa8cd1c2 100644
--- a/entity/ObjectRelationType_entity/entityfields/removeactiongroup/children/removeusage/onActionProcess.js
+++ b/entity/ObjectRelationType_entity/entityfields/removeactiongroup/children/removeusage/onActionProcess.js
@@ -6,9 +6,10 @@ import("Sql_lib");
 
 if (vars.get("$field.UID") && vars.get("$field.DEST_OBJECTRELATIONTYPEID"))
 {
-    db.deleteData("AB_OBJECTRELATION", SqlCondition.begin()
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID").build("1=2"));
+    newWhere("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
+        .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
+        .deleteData(true, "AB_OBJECTRELATION");
+    
     question.showMessage(translate.withArguments("Deleted all usages of \"%0\".", [translate.text(vars.get("$field.SOURCE_RELATION_TITLE")) + " -> " + translate.text(vars.get("$field.DEST_RELATION_TITLE"))]), question.INFORMATION, translate.text("Successful"))
 }
 
diff --git a/entity/ObjectRelationType_entity/entityfields/usagecount_param/valueProcess.js b/entity/ObjectRelationType_entity/entityfields/usagecount_param/valueProcess.js
index 2ea7aca8980ad01e9086033002dbfb72989c1021..6887bcbe34106a82d60b2d9be6c4144b8afc7a26 100644
--- a/entity/ObjectRelationType_entity/entityfields/usagecount_param/valueProcess.js
+++ b/entity/ObjectRelationType_entity/entityfields/usagecount_param/valueProcess.js
@@ -1,8 +1,11 @@
+import("system.vars");
+import("system.logging");
 import("Sql_lib");
 import("system.db");
 import("system.result");
 
-result.object(db.cell(SqlCondition.begin()
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
-                                   .buildSql("select count(*) from AB_OBJECTRELATION", "1=2")));
\ No newline at end of file
+result.object(newSelect("count(*)")
+                .from("AB_OBJECTRELATION")
+                .whereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
+                .andIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
+                .cell(true, "0"));
\ No newline at end of file
diff --git a/entity/ObjectRelationType_entity/recordcontainers/jdito/onDelete.js b/entity/ObjectRelationType_entity/recordcontainers/jdito/onDelete.js
index 19d5361663e81d977195b858044c1116cb3ae6b7..1a417b248a4d5d42e6ddd34986aefc7f1b768a94 100644
--- a/entity/ObjectRelationType_entity/recordcontainers/jdito/onDelete.js
+++ b/entity/ObjectRelationType_entity/recordcontainers/jdito/onDelete.js
@@ -4,16 +4,12 @@ import("system.translate");
 import("system.question");
 import("Sql_lib");
 
-var usageCount = db.cell(SqlCondition.begin()
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
-                                   .andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
-                                   .buildSql("select count(*) from AB_OBJECTRELATION", "1=2"))
+var usageCount = vars.get("$param.UsageCount_param");
 
 if (usageCount <= 0)
 {
-    db.deleteData("AB_OBJECTRELATIONTYPE", SqlCondition.begin()
-                                   .andPrepareVars("AB_OBJECTRELATIONTYPE.RELATION_TYPE", "$field.RELATION_TYPE")
-                                   .build("1=2"));
+    newWhere("AB_OBJECTRELATIONTYPE.RELATION_TYPE", "$field.RELATION_TYPE")
+        .deleteData(true, "AB_OBJECTRELATIONTYPE");
 }
 else
 {
diff --git a/entity/ObjectRelationType_entity/recordcontainers/jdito/onUpdate.js b/entity/ObjectRelationType_entity/recordcontainers/jdito/onUpdate.js
index 7aa7d08ec6109e974c25affc8bbce14a74cc0f2c..2ebed773878043f569a51a931d613bea57708b0a 100644
--- a/entity/ObjectRelationType_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/ObjectRelationType_entity/recordcontainers/jdito/onUpdate.js
@@ -30,10 +30,13 @@ vars.get("local.changed").forEach(function(pChange)
 });
 
 var updates = [];
-var type1Cond = SqlCondition.begin().andPrepare("AB_OBJECTRELATIONTYPE.RELATION_TYPE", vars.get("$field.RELATION_TYPE"))
-                                    .andPrepare("AB_OBJECTRELATIONTYPE.SIDE", "1").build("1=2");
-var type2Cond = SqlCondition.begin().andPrepare("AB_OBJECTRELATIONTYPE.RELATION_TYPE", vars.get("$field.RELATION_TYPE"))
-                                    .andPrepare("AB_OBJECTRELATIONTYPE.SIDE", "2").build("1=2");
+var type1Cond = newWhere("AB_OBJECTRELATIONTYPE.RELATION_TYPE", vars.get("$field.RELATION_TYPE"))
+                    .and("AB_OBJECTRELATIONTYPE.SIDE", "1")
+                    .build();
+                    
+var type2Cond = newWhere("AB_OBJECTRELATIONTYPE.RELATION_TYPE", vars.get("$field.RELATION_TYPE"))
+                    .and("AB_OBJECTRELATIONTYPE.SIDE", "2")
+                    .build();
 
 for (let field in type1Fields) {
     updates.push(["AB_OBJECTRELATIONTYPE", [field], null, [type1Fields[field]], type1Cond]);
diff --git a/entity/ObjectTree_entity/entityfields/objects/children/excludedobjectids_param/valueProcess.js b/entity/ObjectTree_entity/entityfields/objects/children/excludedobjectids_param/valueProcess.js
index afff3a5327c89048c9bd7c6cc0d85adf78fabeaf..e5bc0159b087de4ec4e2bde77c047cad1a94f5e1 100644
--- a/entity/ObjectTree_entity/entityfields/objects/children/excludedobjectids_param/valueProcess.js
+++ b/entity/ObjectTree_entity/entityfields/objects/children/excludedobjectids_param/valueProcess.js
@@ -1,3 +1,4 @@
+import("system.logging");
 import("Sql_lib");
 import("system.vars");
 import("system.result");
@@ -6,16 +7,16 @@ import("ObjectRelation_lib");
 
 var relationTypeData = ObjectRelationUtils.getRelationType(vars.get("$field.OBJECTRELATIONTYPEID"));
 
-var sql1 = SqlUtils.translateStatementWithQuotes(SqlCondition.begin()
-                       .andPrepareVars("AB_OBJECTRELATION.OBJECT1_ROWID", "$field.PARENT_ID")
-                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", relationTypeData[7])
-                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", relationTypeData[8])
-                       .buildSql("select OBJECT2_ROWID from AB_OBJECTRELATION", "1=2"));
-
-var sql2 = SqlUtils.translateStatementWithQuotes(SqlCondition.begin()
-                       .andPrepareVars("AB_OBJECTRELATION.OBJECT2_ROWID", "$field.PARENT_ID")
-                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", relationTypeData[7])
-                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", relationTypeData[8])
-                       .buildSql("select OBJECT1_ROWID from AB_OBJECTRELATION", "1=2"));
-
-result.object([vars.get("$field.PARENT_ID")].concat(db.array(db.COLUMN, sql1 + " union " + sql2)));
\ No newline at end of file
+var ids = newSelect("OBJECT2_ROWID")
+                .from("AB_OBJECTRELATION")
+                .whereIfSet("AB_OBJECTRELATION.OBJECT1_ROWID", "$field.PARENT_ID")
+                .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", relationTypeData[7])
+                .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", relationTypeData[8])
+            .union(newSelect("OBJECT1_ROWID")
+                .from("AB_OBJECTRELATION")
+                .whereIfSet("AB_OBJECTRELATION.OBJECT2_ROWID", "$field.PARENT_ID")
+                .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", relationTypeData[7])
+                .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", relationTypeData[8]))
+            .arrayColumn();
+            
+result.object([vars.get("$field.PARENT_ID")].concat(ids));
\ No newline at end of file
diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
index 19ada032877628d8aab5aed38edb2e0008854eea..f916905b885a498d2592a097cde3150915baf47f 100644
--- a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
@@ -1,3 +1,4 @@
+import("system.logging");
 import("system.db");
 import("system.translate");
 import("system.result");
@@ -276,10 +277,10 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
 {
     if (pRelationType1 == undefined || pRelationType2 == undefined) 
         return [];
- 
+    
     var myNum;
     var otherNum;
-        
+    
     if (pDirection == "normal") 
     {
         otherNum = 1;
@@ -291,27 +292,30 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
         myNum = 1;
     }
         
-    var cond = SqlCondition.begin()
-                           .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pRelationType1)
-                           .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2)
-                           .andPrepare("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId)
-                           .andPrepareIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", pObjectRelationId);
+    onConditionForRelationTypeJoin = newWhere("AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum)
+                                        .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pRelationType1)
+                                        .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2)
+                                        .and("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId)
+                                                                                         // set id to null, as only null works with .andIfSet
+                                        .andIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", (pObjectRelationId ? pObjectRelationId : null));
     
     // exclude previous node
     if (!pPrevId)
-        cond.and("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID is not null");
+        onConditionForRelationTypeJoin.and("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID is not null");
     else
     {
-        cond.andPrepare("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID", pPrevId, "# <> ?");
+        onConditionForRelationTypeJoin.and("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID", pPrevId, "# <> ?");
     }
-        
+    
     // TODO: BINDATA?
     // var image = getImageObject("Beziehung");
-    var data = db.table(cond.buildSql(
-                "select OBJECT" + (pObjectRelationId ? myNum : otherNum) + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO, AB_OBJECTRELATIONTYPEID \n\
-                 from AB_OBJECTRELATION \n\
-                 join AB_OBJECTRELATIONTYPE on AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum + " and ","1=2", "", false));
-    
+    var data = newSelect("OBJECT" + (pObjectRelationId ? myNum : otherNum) + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO, AB_OBJECTRELATIONTYPEID")
+                        .from("AB_OBJECTRELATION")
+                        .join("AB_OBJECTRELATIONTYPE", onConditionForRelationTypeJoin)
+                        .table();
+                        
+   
+                        
     // try again with other side for "same"
     if (data.length == 0 && pDirection == "same" && !pNoRecursion || pObjectRelationId && data.length > 0 && !data[0][ENTRY_DATA.objectId])
     {
@@ -379,13 +383,14 @@ function _getRootID(pObjectId, pObjectRelationTypeData)
     {
         var rootid = sourceid;
         max--;
-        sourceid = db.cell(SqlCondition.begin()
-                                       .andPrepare("AB_OBJECTRELATION.OBJECT2_ROWID", sourceid)
-                                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pObjectRelationTypeData[7])
-                                       .andPrepare("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pObjectRelationTypeData[8])
-                                       .buildSql("select OBJECT1_ROWID from AB_OBJECTRELATION", "1=2"))
+        sourceid = newSelect("OBJECT1_ROWID")
+                    .from("AB_OBJECTRELATION")
+                    .where("AB_OBJECTRELATION.OBJECT2_ROWID", sourceid)
+                    .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pObjectRelationTypeData[7])
+                    .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pObjectRelationTypeData[8])
+                    .cell()
     }
-    while( sourceid != "" && max > 0 );
+    while(sourceid != "" && max > 0);
     return rootid; 
     return currentObjectId;
 }
\ No newline at end of file
diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/onDelete.js b/entity/ObjectTree_entity/recordcontainers/jdito/onDelete.js
index fc1ca5187e5c95cc58f0d5171cb175c8e5150553..0271d85e784f61d3e758070728e0c05d169d2ca5 100644
--- a/entity/ObjectTree_entity/recordcontainers/jdito/onDelete.js
+++ b/entity/ObjectTree_entity/recordcontainers/jdito/onDelete.js
@@ -10,9 +10,8 @@ var isObjectRelationNode = typeof uid[2] == "string";
 if (isObjectRelationNode)
 {
     var objectRelationId = uid[6];
-    db.deleteData("AB_OBJECTRELATION", SqlCondition.begin()
-                                       .andPrepareIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId)
-                                       .build("1=2"));
+    newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId)
+        .deleteData(true, "AB_OBJECTRELATION");
 
     // Refresh otherwise the children of the deleted node would be moved to the root.
     neon.refresh();
diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js
index c62d01d48d36ea557c12c999c9051803d617db39..9356ec327a0c6bd2f8f533c5b6f73da3ca3c6a4f 100644
--- a/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js
@@ -11,8 +11,6 @@ if (isObjectRelationNode)
 {
     var objectRelationId = uid[6];
    
-    db.updateData("AB_OBJECTRELATION", ["INFO"], null, [vars.get("$field.INFO")], 
-                    SqlCondition.begin()
-                                .andPrepareIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId)
-                                .build("1=2"));
+    newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId)
+        .updateData(true, ["INFO"], null, [vars.get("$field.INFO")], "AB_OBJECTRELATION");
 }
diff --git a/entity/Offer_entity/conditionProcess.js b/entity/Offer_entity/conditionProcess.js
index 06d75b37a1d983946fb35c719230574cfc0a7a1e..1fb5c50e9a6eacdb22c14b5d5f1be4a70f87e686 100644
--- a/entity/Offer_entity/conditionProcess.js
+++ b/entity/Offer_entity/conditionProcess.js
@@ -2,8 +2,7 @@ import("system.db");
 import("system.result");
 import("Sql_lib");
 
-var cond = new SqlCondition();
-cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param");
+var cond = newWhereIfSet("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param");
 
-//TODO: use a preparedCondition (.build instead of .translate) when available #1030812 #1034026
-result.string(cond.translate("1 = 1"));
\ No newline at end of file
+//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
+result.string(cond.toString());
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/contact_id/onValueChange.js b/entity/Offer_entity/entityfields/contact_id/onValueChange.js
index 15006677e0cc2ec6dd0ffd120b1b14916637ec69..4d3ecbb18ee4bdbd45431fe3ea9b563c29dab08c 100644
--- a/entity/Offer_entity/entityfields/contact_id/onValueChange.js
+++ b/entity/Offer_entity/entityfields/contact_id/onValueChange.js
@@ -10,9 +10,10 @@ var contactid = vars.get("local.value");
 if(contactid != "")
 {
     //Language Preset
-    var lang = db.cell(SqlCondition.begin()
-        .andPrepare("CONTACT.CONTACTID", contactid)
-        .buildSql("select ISOLANGUAGE from CONTACT"));
+    var lang = newSelect("ISOLANGUAGE")
+                    .from("CONTACT")
+                    .where("CONTACT.CONTACTID", contactid)
+                    .cell();
     if(lang != "") 
         neon.setFieldValue("field.ISOLANGUAGE", lang);
     
diff --git a/entity/Offer_entity/entityfields/contact_id/valueProcess.js b/entity/Offer_entity/entityfields/contact_id/valueProcess.js
index de0433be9112a5780ed0971d1252f0b312b26a75..c50907d05b5a89d6a44af670474fff35f2f6c74d 100644
--- a/entity/Offer_entity/entityfields/contact_id/valueProcess.js
+++ b/entity/Offer_entity/entityfields/contact_id/valueProcess.js
@@ -20,9 +20,10 @@ if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param
 
 if (contactId) 
 {
-    var lang = db.cell(SqlCondition.begin()
-        .andPrepare("CONTACT.CONTACTID", contactId)
-        .buildSql("select ISOLANGUAGE from CONTACT"));
+    var lang = newSelect("ISOLANGUAGE")
+                    .from("CONTACT")
+                    .where("CONTACT.CONTACTID", contactId)
+                    .cell();
 
     if(lang != "") 
         neon.setFieldValue("field.ISOLANGUAGE", lang);
diff --git a/entity/Offer_entity/entityfields/footer/valueProcess.js b/entity/Offer_entity/entityfields/footer/valueProcess.js
index 15f63197dcbb880641f74070d9bdbbd5bcd96d5d..c7d13ea380301efeadd70a5293ed03c5a06ff4bf 100644
--- a/entity/Offer_entity/entityfields/footer/valueProcess.js
+++ b/entity/Offer_entity/entityfields/footer/valueProcess.js
@@ -16,8 +16,10 @@ else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
 
 if (vars.get("$field.ChoosenTEXFooter") != "")
 {
-    var binaryId = db.cell(SqlCondition.begin()
-        .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXFooter")
-        .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getBinariesAlias());
-    result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getBinariesAlias())));
+    var binaryId = newSelect("ID", SqlUtils.getBinariesAlias())
+                        .from("ASYS_BINARIES")
+                        .whereIfSet("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXFooter")
+                        .cell(true);
+    if (binaryId)
+        result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getBinariesAlias())));
 }
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/header/valueProcess.js b/entity/Offer_entity/entityfields/header/valueProcess.js
index a06ff095b12adab740f92f0fd31539ebc47e1a98..65ab407aa9ddd39cea13f8b8fd2ee835fa27e42a 100644
--- a/entity/Offer_entity/entityfields/header/valueProcess.js
+++ b/entity/Offer_entity/entityfields/header/valueProcess.js
@@ -16,8 +16,11 @@ else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
 
 if (vars.get("$field.ChoosenTEXHeader") != "")
 {
-    var binaryId = db.cell(SqlCondition.begin()
-        .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXHeader")
-        .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getBinariesAlias());
-    result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getBinariesAlias())));
+    var binaryId = newSelect("ID", SqlUtils.getBinariesAlias())
+                        .from("ASYS_BINARIES")
+                        .whereIfSet("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXHeader")
+                        .cell(true);
+                        
+    if (binaryId)
+        result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getBinariesAlias())));
 }
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js b/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js
index 0a2a0ee65d4db10c8e023e7e2849fbde9b6de533..bb31cb49def7b5b799a4861f325a76d4430ad3ef 100644
--- a/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js
+++ b/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js
@@ -4,9 +4,9 @@ import("system.result");
 import("system.vars");
 import("Sql_lib");
 
-var iso3 = vars.get("$field.ISOLANGUAGE");
-var latinName = db.cell(SqlCondition.begin()
-    .andPrepare("AB_LANGUAGE.ISO3", iso3)
-    .buildSql("select NAME_LATIN from AB_LANGUAGE", "1=0"));
-latinName = translate.text(latinName);
-result.string(latinName);
+var latinName = newSelect("NAME_LATIN")
+                    .from("AB_LANGUAGE")
+                    .where("AB_LANGUAGE.ISO3", "$field.ISOLANGUAGE")
+                    .cell();
+
+result.string(translate.text(latinName));
diff --git a/entity/Offer_entity/entityfields/printoffer/stateProcess.js b/entity/Offer_entity/entityfields/printoffer/stateProcess.js
index bb8a76fc6373e23f7ea9e562c2bcedad4c6b5bdb..bf47a920e1a8bc096cac555807bb97ed64aaaaf2 100644
--- a/entity/Offer_entity/entityfields/printoffer/stateProcess.js
+++ b/entity/Offer_entity/entityfields/printoffer/stateProcess.js
@@ -3,9 +3,10 @@ import("system.db");
 import("Sql_lib");
 import("system.neon");
 
-var itemcount = db.cell(SqlCondition.begin()
-                    .andPrepareVars("OFFERITEM.OFFER_ID", "$field.OFFERID")
-                    .buildSql("select count(*) from OFFERITEM", "1=2"));
+var itemcount = newSelect("count(*)")
+                    .from("OFFERITEM")
+                    .whereIfSet("OFFERITEM.OFFER_ID", "$field.OFFERID")
+                    .cell(true, "0");
                                        
 if(itemcount == "0")
     result.string(neon.COMPONENTSTATE_DISABLED);
diff --git a/entity/Offer_entity/onDBDelete.js b/entity/Offer_entity/onDBDelete.js
index 5c36082b9691235f56ae00de76af5eca4d528c14..066cc33ad00409ba655054ad2bfe48743f2d26ad 100644
--- a/entity/Offer_entity/onDBDelete.js
+++ b/entity/Offer_entity/onDBDelete.js
@@ -2,4 +2,5 @@ import("Sql_lib");
 import("system.vars");
 import("system.db");
 
-db.deleteData("OFFERITEM", SqlCondition.equals("OFFERITEM.OFFER_ID", vars.getString("$field.OFFERID"), "1=2"));
\ No newline at end of file
+newWhere("OFFERITEM.OFFER_ID", "$field.OFFERID")
+    .deleteData(true, "OFFERITEM");
\ No newline at end of file
diff --git a/entity/Offer_entity/recordcontainers/db/conditionProcess.js b/entity/Offer_entity/recordcontainers/db/conditionProcess.js
index e9466d0d8aa725a4b86afd5ed52df4c87b061179..001612ec1946c47b24fee4e07a2273b60586162e 100644
--- a/entity/Offer_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Offer_entity/recordcontainers/db/conditionProcess.js
@@ -3,16 +3,16 @@ import("system.db");
 import("system.result");
 import("Sql_lib");
 
-var cond = new SqlCondition();
+var cond = newWhere()
 
 if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
-    cond.andPrepareVars("OFFER.CONTACT_ID", "$param.ContactId_param");
+    cond.andIfSet("OFFER.CONTACT_ID", "$param.ContactId_param");
 else {
-    cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param");
-    cond.andPrepareVars("OFFER.OBJECT_TYPE", "$param.ObjectType_param");
+    cond.andIfSet("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param");
+    cond.andIfSet("OFFER.OBJECT_TYPE", "$param.ObjectType_param");
 }
 
-cond.andPrepareVars("OFFER.STATUS", "$param.OfferStatus_param")
+cond.andIfSet("OFFER.STATUS", "$param.OfferStatus_param")
 
-//TODO: use a preparedCondition (.build instead of .translate) when available #1030812 #1034026
-result.string(cond.translate("1 = 1"));
\ No newline at end of file
+//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
+result.string(cond.toString());
\ No newline at end of file
diff --git a/entity/Offer_entity/recordcontainers/db/onDBDelete.js b/entity/Offer_entity/recordcontainers/db/onDBDelete.js
index 5c36082b9691235f56ae00de76af5eca4d528c14..066cc33ad00409ba655054ad2bfe48743f2d26ad 100644
--- a/entity/Offer_entity/recordcontainers/db/onDBDelete.js
+++ b/entity/Offer_entity/recordcontainers/db/onDBDelete.js
@@ -2,4 +2,5 @@ import("Sql_lib");
 import("system.vars");
 import("system.db");
 
-db.deleteData("OFFERITEM", SqlCondition.equals("OFFERITEM.OFFER_ID", vars.getString("$field.OFFERID"), "1=2"));
\ No newline at end of file
+newWhere("OFFERITEM.OFFER_ID", "$field.OFFERID")
+    .deleteData(true, "OFFERITEM");
\ No newline at end of file
diff --git a/entity/Offeritem_entity/entityfields/price/displayValueProcess.js b/entity/Offeritem_entity/entityfields/price/displayValueProcess.js
index 7937b0dc6cf9ab0750c43be49a0accec6fb27e56..e637f9b6adf09bb49a711742f90d24389c9bddfe 100644
--- a/entity/Offeritem_entity/entityfields/price/displayValueProcess.js
+++ b/entity/Offeritem_entity/entityfields/price/displayValueProcess.js
@@ -13,9 +13,10 @@ var curr = vars.get("$param.Currency_param")
 }
 
 else {
-     curr = db.cell(SqlCondition.begin()
-                    .andPrepareVars("OFFER.OFFERID", "$field.OFFER_ID")
-                    .buildSql("select CURRENCY from OFFER", "1=2"));
+     curr = newSelect("CURRENCY")
+                .from("OFFER")
+                .whereIfSet("OFFER.OFFERID", "$field.OFFER_ID")
+                .cell(true);
 }
 
 result.string(NumberUtils.formatWithCurrency(vars.get("$field.PRICE"), translate.text("#,##0.00"), curr));
\ No newline at end of file
diff --git a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
index 5870914adc13d6d7af1b645a873b5c9c76e89fb9..3bad73db28fa32f6f74a7faca5e8767c1e54dc3b 100644
--- a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
+++ b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
@@ -19,11 +19,12 @@ if(pid != "")
     
     //TODO: loading from db until loading from Consumer is possible.
     var ProductDetails = ProductUtils.getProductDetails(pid, PriceListFilter, 
-            [["info", SqlUtils.translateStatementWithQuotes(SqlCondition.begin()
-                                  .andPrepareVars("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "local.value")
-                                  .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE = 'Product'")
-                                  .andPrepareVars("DESCRIPTIONTRANSLATION.LANG", "$param.Language_param")
-                                  .buildSql("(select DESCRIPTION from DESCRIPTIONTRANSLATION", "1=2", ")"))]
+            [["info", "(" + newSelect("DESCRIPTION")
+                            .from("DESCRIPTIONTRANSLATION")
+                            .whereIfSet("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "local.value")
+                            .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE = 'Product'")
+                            .andIfSet("DESCRIPTIONTRANSLATION.LANG", "$param.Language_param")
+                            .toString() + ")"]
             ]);
     
     if(ProductDetails.productId != undefined)
diff --git a/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js b/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js
index 106a609bee58eae9b4557c2bf76288b70fa96f0d..f23c116341674384a3368d928d986d2fb04466e3 100644
--- a/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js
+++ b/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js
@@ -13,9 +13,10 @@ var curr = vars.get("$param.Currency_param")
 }
 
 else {
-     curr = db.cell(SqlCondition.begin()
-                    .andPrepareVars("OFFER.OFFERID", "$field.OFFER_ID")
-                    .buildSql("select CURRENCY from OFFER", "1=2"));
+     curr = newSelect("CURRENCY")
+                .from("OFFER")
+                .whereIfSet("OFFER.OFFERID", "$field.OFFER_ID")
+                .cell(true);
 }
 
 result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalPrice"), translate.text("#,##0.00"), curr));
\ No newline at end of file
diff --git a/entity/Offeritem_entity/recordcontainers/db/conditionProcess.js b/entity/Offeritem_entity/recordcontainers/db/conditionProcess.js
index 935c6d7b06f543932bafe5d2cb5cdf70d7bed013..82c536561aaac4f8a876433b2311a932cc7b50f4 100644
--- a/entity/Offeritem_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Offeritem_entity/recordcontainers/db/conditionProcess.js
@@ -3,8 +3,7 @@ import("Sql_lib");
 import("system.result");
 import("system.vars");
 
-var cond = SqlCondition.begin()
-                       .andPrepareVars("OFFERITEM.OFFER_ID", "$param.OfferId_param")
+var cond = newWhereIfSet("OFFERITEM.OFFER_ID", "$param.OfferId_param")
 
-//TODO: use a preparedCondition (.build instead of .translate) when available #1030812 #1034026
-result.string(cond.translate("1=1"));
\ No newline at end of file
+//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
+result.string(cond.toString());
\ No newline at end of file
diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js b/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js
index 568700b215786effb8a1556df300e84cd46d1ad2..b57a000dc524159f6bb77bd4472eeb4b1b563353 100644
--- a/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js
+++ b/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js
@@ -16,8 +16,9 @@ if(oid != "")
     var cols = ["NET", "VAT"];
     
     var vals = oiUtils.getNetAndVat(deletedIds);
-
-    db.updateData("OFFER", cols, null, vals, SqlCondition.equals("OFFER.OFFERID", oid, "1 = 2"));
+    
+    newWhere("OFFER.OFFERID", oid)
+        .updateData(true, cols, null, vals, "OFFER")
     
     neon.refresh();
 }
\ No newline at end of file
diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
index 317fce086c92e7e36cb070594c3fb2a756b386d0..04e755228fd4771188fe9d9adb357fc02e9c3b15 100644
--- a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
+++ b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
@@ -22,6 +22,6 @@ if(oid != "")
     var vals = oiUtils.getNetAndVat();
     var cols = ["NET", "VAT"];
 
-    db.updateData("OFFER", cols, null, vals, SqlCondition.equals("OFFER.OFFERID", oid, "1 = 2"));
-    
+    newWhere("OFFER.OFFERID", oid)
+        .updateData(true, cols, null, vals, "OFFER");    
 }
\ No newline at end of file
diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js b/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js
index 01bec1734b9df50f7bf027cb4fcad0251e19e8cb..604a63f14f6a2543baaea9add368f8e61fa5357a 100644
--- a/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js
+++ b/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js
@@ -10,5 +10,6 @@ if(oid != "")
     var cols = ["NET", "VAT"];    
     var oiUtils = new OfferItemUtils(oid);
     
-    db.updateData("OFFER", cols, null, oiUtils.getNetAndVat(), SqlCondition.equals("OFFER.OFFERID", oid, "1 = 2"));
+    newWhere("OFFER.OFFERID", oid)
+        .updateData(true, cols, null, oiUtils.getNetAndVat(), "OFFER");    
 }
\ No newline at end of file
diff --git a/entity/Order_entity/entityfields/cancel/onActionProcess.js b/entity/Order_entity/entityfields/cancel/onActionProcess.js
index f138c6f5779923d74ae1b3ecb9202739a28f1ad6..fa3f5510b56bb63838d642e06492f11e056b892b 100644
--- a/entity/Order_entity/entityfields/cancel/onActionProcess.js
+++ b/entity/Order_entity/entityfields/cancel/onActionProcess.js
@@ -8,9 +8,9 @@ import("KeywordRegistry_basic");
 
 var id = vars.get("$field.SALESORDERID");
 
-db.updateData("SALESORDER", ["CANCELLATION"], null, ["1"], SqlCondition.begin()
-                                                                       .andPrepareVars("SALESORDER.SALESORDERID", "$field.SALESORDERID")
-                                                                       .build("1=2"));
+newWhereIfSet("SALESORDER.SALESORDERID", "$field.SALESORDERID")
+    .updateData(true, ["CANCELLATION"], null, ["1"], "SALESORDER")
+
 neon.refreshAll();
 
 var contactId = vars.getString("$field.CONTACT_ID");
diff --git a/entity/Order_entity/entityfields/cancel/stateProcess.js b/entity/Order_entity/entityfields/cancel/stateProcess.js
index 64b25ea3d5a2cc521c892377b25790da145d9b02..ec7809f90e7917866e6dc4352b6e26c485418d28 100644
--- a/entity/Order_entity/entityfields/cancel/stateProcess.js
+++ b/entity/Order_entity/entityfields/cancel/stateProcess.js
@@ -6,9 +6,10 @@ import("system.neon");
 import("Keyword_lib");
 import("KeywordRegistry_basic");
 
-var itemcount = db.cell(SqlCondition.begin()
-                    .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID")
-                    .buildSql("select count(*) from SALESORDERITEM", "1=2"));
+var itemcount = newSelect("count(*)")
+                    .from("SALESORDERITEM")
+                    .whereIfSet("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID")
+                    .cell(true, "0");
                                        
 if(itemcount == "0")
     result.string(neon.COMPONENTSTATE_DISABLED);
diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js
index 1b774c9486d5196b18b79d421fffb07654a9947f..8daa0c113d106ba981dbc86c357d98f48d46aff1 100644
--- a/process/Sql_lib/process.js
+++ b/process/Sql_lib/process.js
@@ -1757,7 +1757,7 @@ SqlBuilder.prototype.deleteData = function(pExecuteOnlyIfConditionExists, pTable
  * @param {Boolean} [pExecuteOnlyIfConditionExists=false] if true and there is no condition, "" is returned
  * @return {String} the result of the query
  */
-SqlBuilder.prototype.cell = function(pExecuteOnlyIfConditionExists)
+SqlBuilder.prototype.cell = function(pExecuteOnlyIfConditionExists, pFallbackValue)
 {
     if (this._checkForSelect(pExecuteOnlyIfConditionExists))
     {
@@ -1766,7 +1766,7 @@ SqlBuilder.prototype.cell = function(pExecuteOnlyIfConditionExists)
     }
     else
     {
-        return "";
+        return (pFallbackValue ? pFallbackValue : "");
     }
 }