Skip to content
Snippets Groups Projects
Commit f7424c11 authored by Maximilian Hofmann's avatar Maximilian Hofmann Committed by Johannes Hörmann
Browse files

documentation

parent cca06c33
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ var myDescriptiveNameOfTheTree = new DataTree(alias);
// or
var myDescriptiveNameOfTheTree = DataTree.begin(alias);
----
* use the object, add conditions
* use the object, add conditions with add(uid, parent, itemArray)
[source,javascript]
----
var myTree = myDescriptiveNameOfTheTree.add("1", "myRoot", ["itemId1", "value"])
......@@ -44,7 +44,7 @@ var myTree = myDescriptiveNameOfTheTree.add("1", "myRoot", ["itemId1", "value"])
.add("3", "2", ["itemId3", "value"])
.add("4", "2", ["itemId4", "value"])
.add("5", "4", ["itemId5", "value"])
.add("5", "3", ["itemId5", "value"]) // Now you added id "5" a seccond time.
.add("5", "3", ["itemId5", "value"]) // Now you added id "5" a second time, overrides previous entry with id 5
.getTreeObject();
var myArray = myDescriptiveNameOfTheTree.toArray();
......@@ -92,7 +92,7 @@ var myTree = myDescriptiveName.add("1", "myRoot", ["itemId1", "value"])
Note that if you add an item two times, only the data-array of the second item is used! It will overwrite the data from the first one!
== When to use which ==
If you only need a array with parent - child - structure e.g. for the treetable or charts, use
If you only need an array with parent - child - structure e.g. for the treetable or charts, use
ReferencingData
If you need a tree object for your logic, use DataTree.
\ No newline at end of file
......@@ -29,8 +29,8 @@ var myDescriptiveNameOfTheCondition = SqlCondition.begin(alias);
* use the object, add conditions
[source,javascript]
----
myDescriptiveNameOfTheCondition.orPrepare("PERSON.FIRSTNAME", "Bob")
.orPrepare("PERSON.LASTNAME", "Meier");
myDescriptiveNameOfTheCondition.orPrepare("PERSON.FIRSTNAME", "Bob")
.orPrepare("PERSON.LASTNAME", "Meier"); // orPrepare explained in "available methods" below
----
* You can also use table aliases, if you provide the table, column and alias as array.
The table name has to be provided for loading the data types but the alias is built into the sql.
......@@ -82,11 +82,11 @@ The field name needs to be given with
Or if you use only COLUMNNAME, you have to provide the fieldType.
But keep in mind: Other than the original adito db. functions this lib caches the field types automatically (for the livetime of an SqlCondition Object).
So most times it is save to use the first method. Even in loops or if you use the same Column several times.
So most times it is save to use the first method. Even in loops or if you use the same column several times.
[source,javascript]
----
myDescriptiveNameOfTheCondition.orPrepared("PERSON.FIRSTNAME", 'Bob', "#<?");
myDescriptiveNameOfTheCondition.orPrepared("PERSON.FIRSTNAME", 'Bob', "#<?"); // #(field) < ?(value)
----
=== andPreparedVars / orPreparedVars ===
......@@ -126,7 +126,7 @@ var myConditionSql = myDescriptiveNameOfTheCondition.toWhereString("1=0");
----
=== preparedValues ===
This is no method but a membervariable.
This is no method but a member variable.
It contains the array with the prepared values.
[source,javascript]
......
......@@ -25,7 +25,7 @@ If you connect to *EmailCommunications* you get *only the Email* communication t
If you connect to *PhoneCommunications* you get *only the Phone* communication type of a contact.
*Important:*
*Do not always create a new provider when connecting a new entity. Maybe u can use an already existing provider.*
*Do not always create a new provider when connecting a new entity. Maybe you can use an already existing provider.*
*Try to reuse providers if you need similar data for two dependencies*
=== Consumer ===
......
......@@ -16,4 +16,4 @@ It is configured by two properties of the providers.
* targetContextField
* targetIdField
You can provide an entity-field for each of them which contain the contextId (currently the contextName 13.02.2019) and the rowId (UID) which should be used to open the preview or main view.
\ No newline at end of file
You can provide an entity-field for each of them which contains the contextId (currently the contextName 13.02.2019) and the rowId (UID) which should be used to open the preview or main view.
\ No newline at end of file
How to write JDito code
=======================
:toc2: left
:numbered:
......@@ -115,7 +114,7 @@ function SqlCondition(pAlias) <4>
{
//setting null is only needed to provide autocomplete for the ADITO-designer
this.preparedValues = null;
this._init();//the properties are initalized in an extra function because init is nearly the same as resetting (clearing) the SqlConditions
this._init();//the properties are initialized in an extra function because init is nearly the same as resetting (clearing) the SqlConditions
this.alias = alias;
}
/**
......@@ -142,12 +141,12 @@ So just start your functions / methods name with a _ if you need private methods
--> do not use functions which start with a _ outside of the class!
Add @ignore to the comment of the private functions.
Add @ignore to the comment of those functions to prevent showing them in the generated jsdoc.
== JS-Doc ==
<1> JS-Doc comment: http://usejsdoc.org/
<2> jsdoc-blocks have to start with /&#x002A;&#x002A; because the tool to generate docs out of jsdoc only works with /&#x002A;&#x002A;
<2> jsdoc-blocks have to start with /&#x002A;&#x002A; otherwise JSDoc cannot generate a documentation
<3> use the correct form for optional/required parameters: http://usejsdoc.org/tags-param.html
Optional parameter: [alias=the current alias]
Required parameter: alias
......@@ -167,10 +166,9 @@ function SqlCondition(pAlias)
...
}
----
<3> examples are useful on more complex functions
<4> constructor function; init properties (do not set functions ("methods") here!)
<5> add functions ("methods") to the prototype, they are available through the prototype chain
<6> the comments have to start with /&#x002A;&#x002A; not /&#x002A; otherwise JSDoc cannot generate a documentation
<4> examples are useful on more complex functions
<5> constructor function; init properties (do not set functions ("methods") here!)
<6> add functions ("methods") to the prototype, they are available through the prototype chain
And how to use it (normally you'd want to use preparedStatements but for the sake of an easy example it's a bit shorter here)
See also HowToSqlConditionLib.adoc for a full documentation.
......
......@@ -17,7 +17,7 @@ TINYINT
Add nullable="false" constraint, because for boolean null makes no sense and complicates searches and validations.
== Text ==
Text should be saved as Unicode. For this prefix the datatype with a 'N' (there are some exceptions lik the UUID)
Text should be saved as Unicode. For this prefix the datatype with a 'N' (there are some exceptions like the UUID)
=== Big text ===
For informations, descriptions, ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment