How can I use TaggedValues within a DDL script? - enterprise-architect

I'd like to generate table creation code for my data model. This works great, I have changed the default DDL templates.
Now I have a feature which can be set or not for a table (TemporalTable). This in turn will generate different DDL (sql) code based on the TaggedValue value.
How can I access a TaggedValue from a table within the DDL template script?

What you are looking for is described in the help here
For a user defined tagged value on a table that would be:
tableUserProperty:"propertyName"
Returns the value for the
user-defined property in the repository's version of the current
Table.
Parameters
propertyName - the property name that is to be retrieved
Remarks
None.

Related

Query script not run in suggest box

In AppMaker, one my datasources has a simple query script associated with, because I need a filter everytime the datasource is requested. I'm talking about a normal SQL based datasource (not calculated).
Is it normal than this query script is not used when the datasource is used in a Suggest box ? Because it breaks my app (the user is able via the suggest box to select items he's not even supposed to see).
Thanks for your help
The options for a suggest field text box can either be provided explicitly, by binding to the options property, or by specifying a database query on a model using a startsWith filter on a field. You can set the model and field for the latter option below.
So you can try to create calculated model with server script starts with
var name = query.filters.name.startsWith;
name is field of model

Filemaker Pro 14 History tables

With a few solutions Ive worked with I've created temp table's or history tables. Normally I script it to take a handful of fields needed from a main table and copy it over to the other table by
Setting a variable then setting field to the variable for each field in the new table / new record.
I have a situation now, where Im building a history table that needs to copy the current record as is. A snapshot where all fields from that instance of the record are copied to the history table.
Rather then setting a variable then set field to the variable, Id like to get some input on a quicker way to get this done where I can do this on a record level and not type out field by field to get it done. Also if fields are added to both tables then I have to make sure my script gets updated.
Ill keep hunting around.. appreciate any help.
-Rich
Do you have a sample of copying a record from 1 table to another
including all fields and setting some fields?
As I suggested in comments, use the Import Records[] script step, and select the same file as the source. If you choose Arrange by: [ matching names ] in the Import Field Mapping dialog, it will automatically map all source fields to their similarly named counterparts.
Note that you must establish a found set in the source table before importing.
For "setting some fields", you can define auto-enter options and activate them during the import, or run Replace Field Contents[] immediately after the import.

Determine identity generation in DB2

In DB2 9.7, when you CREATE a table and specify a column with identity. You can specify the method in which it will handle the generation. You have two choices GENERATED ALWAYS or GENERATED BY DEFAULT.
Once the table has been created how can you tell which method it's using (without performing an insert)?
From the Control Center, I tried to generate the DDL to see how it would generate it, but I'm not certain this is accurate.
You can find all schema-related information in the DB2 system catalog. The view SYSCAT.COLUMNS holds the core data about columns and their properties. To determine whether a column is GENERATED ALWAYS or GENERATED BY DEFAULT look at the column GENERATED in that column.

How to apply new changes without dropping current data in the db.(Playframework evaluations)

I'm using play 2.2.1 with scala. And I have a managing database evaluations. When I run my application with changes on the database, it'll drop all my datas.
At this moment evaluationplugin = disabled is comment in. If I comment out, it does not apply my changes.
For example. I have a users table and there are id, f_name, l_name
User
id f_name l_name
1. khazo rasp
And I want to add age field to this table without losing data. I've added this field in scala files.It works properly. I'm assuming I need to write script in 1.sql for some alter command, but I don't want to write script.
How to apply new changes without dropping current data in the db. I've read this documentation. Thanks in advance.
I've added this field in scala files
In slick (you have the tag play-slick), you can specify a default value in your Table
See the documentation here, under Tables:
Default[T](defaultValue: T)
Specify a default value for inserting data the table without this column. This information is only used for creating DDL statements so that the database can fill in the missing information.
I am not sure if it gets translated to ALTER statement if the table already exists . You will have to test it.

I want to Dynamically access SQLite result set?

I want to dynamically access SQLite result set. Since webworks/javascript doesnt support "PRAGMA table_info(table_name); I am saving all newly created tables information in a single two column table called schema. schema has two columns, table_name and column_name.
So I created a function to access table data dynamically. I use the item=results.rows.item(i) and than access row data with item.column.
column is a variable that is assigned the value from schema, representing the column_name. When I alert(column) I get the correct column_name, but when I used item.column my results are "undefined".
any advice on how to resolve this matter.
If I understand you correctly, column is a variable that holds the value of a column name, and you want to access that column from the results item. If that's the case, then this might help:
//Assuming "var column" has already been defined,
//and given the value of the column name to be accessed in the results item.//
var item = results.rows.item(i);
var columnValue = item[column];
I struggled with this too, and this is what I found/use. You put in brackets the variable containing the column name, and that's how you access it.
EDIT: This is obviously Javascript stuff, and what I used for accessing SQLite in PhoneGap. Hopefully it helps.