In this article
The following functions are specific to Database Designer:
| Function | Description | Example |
|---|---|---|
| GetAdditionalColumnValue(string key, string columnName, int schemaId, int tableId, int languageId (optional)) | Will return the value, in the specified language (default language, if not specified), of the additional column from table tableId in database designer schema schemaId for the given key. GetAdditionalColumnValue can be used to get extra information for a given key. For example, Get County for a given ZipCode. | GetAdditionalColumnValue(”10001”,”city”,23,53,9) |
| GetLookupId(string key, int schemaId, int relationId) | Returns the lookup Id from a relation relationId in database designer schema schemaId for the given key. Or null if not found. | var id = GetLookupId(“bmw”, 12, 23); CarId = id; |
| GetLookupLabel(string key, int schemaId, int realtionId, int languageId) | Returns the lookup label from a relation relationId in database designer schema schemaId for the given key. | var label = GetLookupLabel(“bmw”, 12, 23, 20); CarLabel = label; |
| GetLookupValue(string key, int schemaId, int relationId, int languageId (optional)) | Returns a LookupValue object for the given key from a relation relationId in database designer schema schemaId. The objects label will be in the default language. If the key is not found, null is returned. The LookupValue object returned has Id and Label as properties. | var lv = GetLookupValue(“bmw”, 12, 23); CarLabel = lv.Label; |
| GetParentId(string key, int schemaId, int relationId ) | When there is a relation with id relationId in a schema with id schemaId in Database Designer, GetParentId can be used to return the id of the parent of the item with id key. The function can be used both for relations between two different tables or a selfref (parent/child) within one table. | In a schema with schemaid 5, with a parentRel relation beween (Employee=>Org) with relationid 34. And the table employee has id English parentRel And the table Org has id English GetParentId (“jd”, 5, 34) will return “rd” |
| GetTableValue(string key, int schemaId, int tableId, int languageId (optional)) | Will return the value (answer label) of the key in the given language from table tableId in database designer schema schemaId (default language, if languageId not specified). Returns string, or null if not found. | var answerLabel = GetTableValue("8",4223,9); |
| IsTableKeyValid(string key, int schemaId, int tableId) | Will check if the given key exists in table tableId in database designer schema schemaId. Used to validate if a key specified on a respondent actually exists in the database table. Returns Boolean true if key exists in table, false if not. | if ( IsTableKeyValid("zip1245", 14, 255) ) { MyEnglishZipCodeLabelVar = GetTableValue ("zip1245", 14, 255); //Uses default language, which in this example is English MyNorwegianZipCodeLabelVar = GetTableValue ("zip1245", 14, 255, 20); } |