Definition of the data pool for placeholder.

Definition of the data pool for placeholder.

Datat for placeholder can come form various pools:

If a connection is set up to a database or to SOAP, this source will always be preferred. To request or change individual data from databases, use the modules query or soap. For XML file-based data use the xmlquery module. Variables from type DataPool contain the required connection. You can set the values of these variables independently of the current InDesign® connection.

If you have set up a database connection in InDesign®, a call by datapool::set_dbc (pool, 0) hides all calls to the connected database. For example, the function document::place_items would therefore not attempt to read your required data (the description of the templates) from the database, but from the currently defined XML file instead. If you change this setting too by using datapool::set_files (pool, "neuer Pfad"), the master will be retrieved from this path.

static DataPool alloc()

Create a new variable from the datapool data type. The variable will be automatically filled with the current settings in InDesign®. The database connection contains the value of sql::dbconnection. The file connection contains the value xml::app_path. The variable must be deleted again using datapool::release.

Name Type Default Description
Return DataPool   A new object of type DataPool

DataPool		pool	= datapool::alloc ();
  : datapool::release (pool);

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

sql::dbconnection, xml::app_path

static int release(DataPool pool)

Delete a variable of the datapool type. Following the call of this function, the value of the variable may not longer be accessed.

Name Type Default Description
Return DataPool   A new object of type DataPool

DataPool		pool	= datapool::alloc ();
  : datapool::release (pool);

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

datapool::alloc

static int type(DataPool pool = 0)

Type of the (current) database connection.

Name Type Default Description
Return int   kNotConnected
kDBCConnection
kXMLConnection
kSOAPConnection
pool DataPool 0 From which database connection is the type to be derived?

0 - current file connection
otherwise - Type of the specified connection

#include "internal/types.h"

Version 1.2.2 (16. Nov. 2005)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int set_dbc(DataPool pool, int* dbc)

Set the database connection of the datapool. The command has the particular function of suppressing the storing and writing of data to/from the database, even though the database connection has been created via InDesign®. For the database connection only 0 or the currently valid connection (sql::dbconnection) may be used.

Name Type Default Description
Return int   0 or Error code
pool DataPool - Defined datapool
dbc int*, DBC or SOAP - Database connection or 0 For the database connection only 0 or the currently valid connection (sql::dbconnection, soap::connection).

DataPool		pool	= datapool::alloc ();
datapool::set_dbc (pool, 0);
  : datapool::release (pool);

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

sql::dbconnection, datapool::get_dbc

static int set_files(DataPool pool, char* fpath)

Set the file source of the datapool. For the file pool a folder must be specified, which corresponds to the definitions of Werk II.

You will find the correct definition of the file pool and its place in the folder structure from the document of the functions which use a datapool.

Name Type Default Description
Return int   0 or Error code
pool DataPool - Defined datapool
fpath String or char* - File source of the pool

DataPool		pool	= datapool::alloc ();
char			myxmlpath[4069];
document::folder (myxmlpath); strcat (myxmlpath, "/"); strcat (myxmlpath, "xmldata"); datapool::set_files (pool, myxmlpath);
  : datapool::release (pool);

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

xml::app_path, datapool::get_files

static int* get_dbc(DataPool pool)

Ascertain the database connection of the datapool. On basis of datapool::alloc this value is the current database connection of Indesign® and corresponds to the result of the function sql::dbconnection.

Name Type Default Description
Return int*, DBC oder SOAP   Database connection of the pool. On basis of datapool::alloc this value is the current database connection and corresponds to teh result of the function sql::dbconnection bzw. soap::connection
pool Datapool - Defined datapool

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

datapool::set_dbc

static char* get_files(DataPool pool, char* result)

Ascertain the database connection of the datapool. On basis of datapool::alloc this value is the current database connection and corresponds to the result of xml::app_path.

Name Type Default Description
Return String or char*   (Depends on parameter result) File connection of the pool. Based on datapool::alloc this value is the current database connection and corresponds to the result of xml::app_path. Same as parameter result
pool DataPool - Defined datapool
result String or char* - Reserved memory for the result

Version 1.1.7

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

datapool::set_files

static int get_products(
  char* statement,
  List l1,
  List l2 = 0,
  List l3 = 0,
  StringList s1 = 0)

Depending on the current selection in the product panel, one or more lists of product IDs will be ascertained. In doing so, sub-entries can be automatically ascertained. To load the sub-entries exactly the same algorithm will be used, which is also executed in the product panel when opening an entry. The sequence in the result lists corresponds to the sequence in the product research panel.

The command requires the product research plugin. The product research must be opened.

The selection of products can be defined using the parameter statement. The following image describes the syntax of the statement using the so called EBNF notation.

If you not familiar with the syntax, it's quite easy:

Here is an example of a valid statement:

  Products selected with no doubles { (id3=31 or id3=32) and ( id2!=0) } id3=31 or id3=32

    

The following table describes the individual parts of the parameter statement. If the parameter is empty, all watched products will be assumed into the result list.
Part Default Description
Panel empty The list of products is retreived from the panel Product pool by default. With ItemPool given as panel, the products are loaded from the panel Products & Items.
Base watched Product Pool panel

Which visible objects of the product pool are to be processed?
  • list : all entries of the list
  • watched : Eye marked entries only

  • selected : All selected products from the list (list selection). Be carefull in this case, the selection is updated automatically if the document selection changes!
  • clean : It' a reorganization call.

More options

[since v3.3 R3303, 26.11.2012] You may wish or not to remove double entries from the result list.
  • with doubles allowed : Entries of the result list must not be unique.
  • with no doubles : Do not insert entries to the result list, if the same entry is already inserted. Attention: The option has no effect for entries in the base list coming directly from the product pool panel!
  [Expand]  

{Expand}
empty This part of the statement typically is the hardest. You define the conditions to check, whether products should load their sub entries or not:
  1. Products matching the condition are inserted into the result list.
  2. Replace with [] : Products not matching the condition(s), aer replaced by their sub products.
  3. Insert with {} : [since v3.3 R3303, 26.11.2012] If a product does not match the condition(s), the sub products of the product are inserted into the result list too.
Conditions

Conditions can be written in the usual syntax or in SQL or xml query, e.g. id1 > 0 and level > 0. See the next table for a list of supported attributes.

Condition1 ? Condition2

If the condition Condition1 for an object is fulfilled, it will be assumed into the result list.

If the condition condition1 is not fulfilled, the condition Condition2 will be tested.

If the condition condition2 is fulfilled, the sub-entry will be loaded. The condition2 condition serve as an interruption criterium but it is possible that the product tree will indeed form circles.

Hints

If you use {...} you should use the option "with doubles allowed" too. Otherwise product pool selections containing products AND sub products of this products will lead to lists containing the sub products twice.
Proof empty After all the products (and sub-products) have been ascertained using the condition condition3, a check can be made to see if the object is at all to remain in the list. If condition3 is not fulfilled, the object will again be removed from the results list.

Name Type/value Description
id int ID of the object comprised of 3 numbers and a (optional) string
id2
id3
stringid char*
pageitemid int The template ID stored in the object
docid int The document ID stored in the object
masterpage char* The master page stored in the object
grid char* The grid stored in the object
gridid int The gird ID stored in the object
element char* The gird element stored in the object
elementid int The gird element ID stored in the object
needsrequest int [0, 1] Are the placements in the object complete?
defined int [0, 1] Are the placements in the database connection possible?
level int Nesting depth in the product tree, uppermost level in 0
relative_level [ab v3.2.3 R2440] Releativ nesting level from the base list entries (list, selected, watched)
substatement int ID of the panel statement to load the sub-object
classid int Class number of the object
row1 char* Text of the first column of the panel
row2 char* Text of the second column of the panel
pre_ruleid int Prehandler of the object
pre_ruleparams char* Parameter for the prehandler
post_ruleid int Posthandler of the object
post_ruleparams char* Parameter for the posthandler
adparams char* Parameter for the placement of ad banners

Name Type Default Description
Return int   0 or Error code
statement String or char* - siehe oben
l1 List - Allocated list for the IDs of the detected objects.
l2 List 0 Allocated list for the ID2s of the detected objects.
l3 List 0 Allocated list for the ID3s of the detected objects
s1 List 0 Allocated string list for the StringIDs of the detected objects

Here is an example for a statement, with which all products and sub-products of the current selection (marked, not watched!) can be collected. In this the object will automatically be dived into if the template of the object has not been defined. The attempt will be ended with a nesting depth of 10. From the resulting list all entries the IDs of which <= 0 will be removed.

selected [pageitemid > 0 ? level < 10] id2 > 2

Get the IDs of the selected products having a template defined.

int main ()
{
    int 		result;
    List		l1	= list::alloc ();
    int		i;
if (gRun != 0) return 0;
result = datapool::get_products (   "selected [pageitemid > 0]",   l1); if (result && result != -1199 { showmessage ("Error %d", result); } else { for (i=0; i < list::length (l1); i++) { showmessage ("%d: %d", i+1, list::get (l1, i)); } }
return 0; }

The third example demonstrates the differences between class-id based stringlists and string lists without any class id allocated. Mark some entries of the product panel with an eye, and select some other entries of the list by hiliting.

int main ()
{
    int 			id1, id2, id3;
    int 			num		= 0;
    List 			prod  	= list::alloc();
    List 			prod2 	= list::alloc();
    List 			prod3 	= list::alloc();
    StringList 		prod4 	= stringlist::alloc ();// StringList without Class-ID
    StringList 		ppp	= stringlist::alloc (3, 1); // StringList with Class-ID
    char			strid[4000];
    char			name[4000];
    char			temp[4000];
if (gRun > 1) return 0; // only once datapool::get_products ("selected ", prod, prod2, prod3, prod4); while (num<list::length(prod)) { id1 = list::get (prod ,num,0); id2 = list::get (prod2,num,0); id3 = list::get (prod3,num,0); stringlist::gettext (prod4, num, "", strid);
strcpy (temp, "get_products %d : \n\n"); strcat (temp, "id1=%d\n"); strcat (temp, "id2=%d\n"); strcat (temp, "id3=%d\n"); strcat (temp, "stringid via stringlist::gettext='%s'\n"); strcat (temp, "stringid via stringlist::get='%s'");
showmessage(temp,   num+1,   id1, id2,id3,   strid,   stringlist::get (prod4, num)); num = num+1; }
num = 0; while (num<stringlist::length(ppp)) { stringlist::gettext (ppp, num, "StringID", strid); stringlist::gettext (ppp, num, "Num", name);
strcpy (temp, "alloc by class 3 : entry %d\n\n"); strcat (temp, "stringid='%s'\n"); strcat (temp, "name='%s'");
showmessage(temp, num+1, strid, name); num = num+1; }
list::release (prod); list::release (prod2); list::release (prod3); list::release (prod4); return 0; }

Version 1.2.1 (21 September 2005)
s1 since Version 1.4.1 R380, 21. Juni 2007

priint:comet InDesign® Plug-Ins, comet_pdf

static int* login(
  int type,
  char* dsn,
  char* user = 0,
  char* password = 0,
  char* dbOrLang = 0,
  char* client = 0,
  int lazy = 1,
  int charset = 0)

Create or change a database connection. Login/Logout is only necessary for InDesign® Server batches, they retreive batch and user data from different sources.

Name Type Default Description
Return int*, DBC, SOAP   Database connection or 0 (for XML paths)
type int - connection type

1 : ODBC
2 : XML
3 : SOAP
dsn String or char * - depends on connection type

ODBC : DSN
XML : path
SOAP : Host.
user String or char * 0 User name, ignored for XML connections
password String or char * 0 password, ignored for XML connections
dbOrLang String or char * 0 database name (ODBC) or language (SOAP), ignored for XML connections
client String or char * 0 Mandant / Client
lazy int 1 Do only (re)connect, if the login data defers from the current connetion
charset int 0 Used Charset

0 : System character set
1 : Unicode
2 : Unicode 32Bit
3 : UTF-8

Version 1.4.1 (15. Juni 2007)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

datapool::logout

static int logout(int type)

Finich current connection

Name Type Default Description
Return int   1 Okay
0 : Error
type int - connection type

1 : ODBC
2 : XML
3 : SOAP

Version 1.4.1 (15. Juni 2007)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

datapool::login

static int get_main_template(
  int pid,
  int* l = 0,
  int* u = 0,
  int* r = 0,
  int* cl = 0,
  int* cu = 0,
  int* cr = 0)

Get the main template and (optionally) the sub templates of a template.

Name Type Default Description
Return int   ID of main template or 0 in case of some errors
pid int - template ID
l, u, r, cl, cu, cr jeweils int* 0 IDs of sub templates. (0 or pointer to an integer variable)

Templates without page restrictions
l : 0
u : TemplateID
r: 0
cl: 0
cu : Continuing template or 0
cl: 0

Page specific templates
l : left pages
u : 0
r: right pages
cl: continuing template for left pages or 0
cu : 0
cl: continuing template for right pages or 0

Get the template that inserted a frame into the document and collect its sub entries.

 
int main ()
{
    char		ename [2000];
    int		tid;
    int		ttid, l, m, r, cl, cm, cr;
tid = frame::get_template (gFrame); ttid = datapool::get_main_template (tid, &l, &m, &r, &cl, &cm, &cr);
wlog ("", "# Frame %d\n", item::getint (gFrame)); wlog ("", "# Template : %d of %d (%s) with [%d, %d, %d, %d, %d, %d]\n",   tid, ttid,   datapool::get_template_name (tid),   l, m, r, cl, cm, cr);
return 0; }

Version 3.2 R2267, 8. Feb. 2011

priint:comet InDesign® Plug-Ins, comet_pdf

get_template_name, frame::get_page_element, frame::get_template

static char* get_template_name(int pid)

Get a templates name.

Name Type Default Description
Return char*   Name of template.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. Learn more about functions returning r/o char* values.

pid int - ID of template

Get the template that inserted a frame into the document and collect its sub entries.

 
int main ()
{
    char		ename [2000];
    int		tid;
    int		ttid, l, m, r, cl, cm, cr;
tid = frame::get_template (gFrame); ttid = datapool::get_main_template (tid, &l, &m, &r, &cl, &cm, &cr);
wlog ("", "# Frame %d\n", item::getint (gFrame)); wlog ("", "# Template : %d of %d (%s) with [%d, %d, %d, %d, %d, %d]\n",   tid, ttid,   datapool::get_template_name (tid),   l, m, r, cl, cm, cr);
return 0; }

Version 3.2 R2267, 8. Feb. 2011

priint:comet InDesign® Plug-Ins, comet_pdf

get_main_template, frame::get_page_element, frame::get_template

static int aem_get_list(
  PublicationList pli,
  char* url,
  char* user,
  char* password,
  char* assetpath = 0,
  int inclRenditions = 0)

EXPERIMENTAL! Get the list of contents of a folder of an AEM® (Adobe Experience Manager®).

Name Type Default Description
Return int   0 or error code
pli PublicationList - Destination list for the list of contents. List must be allocated before using publication::publicationlist::alloc. If the table of contents could be read successfully, the list is emptied automatically before refilling.

You can read the entries of the list using publication::gets:

kName : Name of entry
kType : Type of entry, "assets/folder" oder "assets/asset"
kPath : Path of entry inside the asset component of AEM®
url String oder char* - URL of AEM®
user String oder char* - User name to login into AEM®
password String oder char* - Paasword of user
assetpath String oder char* - Complete path of asset in the asset component of the AEM®. Non-existent folders are created automatically. Existing folders remain unchanged.

0 or empty : root folder ("/")
inclRenditions int 0 Insert renditions into the result list?

0 : No
1 : Yes

#include "internal/publications.h"
#include "internal/publications.h"
char stHost [] = "http://192.168.0.208:4502"; char stUser [] = "admin"; char stPwd [] = "***";
int main () { PublicationList pl = publication::publicationlist::alloc (); Publication p; int i;
wlog ("", "==== /my folder ====\n"); datapool::aem_get_list (pl, stHost, stUser, stPwd, "/my folder", 0); for (i = 0; i < publication::publicationlist::length (pl); i++) { p = publication::publicationlist::get (pl, i); wlog ("", "Name : %s\n", publication::gets (p, kName)); wlog ("", "Type : %s\n", publication::gets (p, kType)); wlog ("", "Path : %s\n", publication::gets (p, kPath)); wlog ("", "\n"); }
publication::publicationlist::release (pl);
return 0; }

v4.1 R22145, 29. März 2018

priint:comet InDesign® Plug-Ins, comet_pdf

file::aem_put_asset, file::aem_put_asset

This class has no child classes.

Since
Version 1.1.7, Januar 2005

Alphabetic index HTML hierarchy of classes or Java