<div>Later enhancements ...</div>
<div> </div>
<div><font size="2"> update $dto.tableName$<br> set $dto.fields : { f |<br>$if(!f.idColumn)$$if(!f.versionColumn)$$if(!f.extraColumn)$<br> $f.dbColName$ = #$<a href="http://f.name">f.name</a>;format="ilc"$:$f.dbColType$#$if(!f.penultimateField)$,$endif$<br>
$endif$$endif$$endif$}$<br> where current of c1; c1;</font></div>
<div><font size="2"></font> </div>
<div><font size="2"></font> </div>
<div><font size="2">But I still have the blank line problem.</font></div>
<div><font size="2"></font> </div>
<div><font size="2"> </font></div><br><br>
<div><span class="gmail_quote">On 7/1/08, <b class="gmail_sendername">David Beckedorff</b> <<a href="mailto:david.beckedorff@gmail.com">david.beckedorff@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>OK, Johannes, cool suggestion!</div>
<div> </div>
<div> </div>
<div>So I added boolean fields 'reqForUpdate' and 'lastFieldForUpdate" to my DtoField class & now the template looks like this:</div>
<div> </div>
<div><font face="courier new,monospace"><span class="q"> update $dto.tableName$<br> set $dto.fields : { f |<br></span>$if(f.reqForUpdate)$<br> $f.dbColName$ = #$<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://f.name/" target="_blank">f.name</a>;format="ilc"$:$f.dbColType$#$if(!f.lastFieldForUpdate)$,$endif$<br>
$endif$}$<br> where current of c1;</font></div>
<div> </div>
<div> </div>
<div>which generates:</div>
<div> </div>
<div><font size="2"><span class="q">
<p> update DP_JRNL_ENTRY<br> set </p></span>
<p> OWNR_PERS_NTL_ID = #ownerId:VARCHAR#,<span class="q"><br> OWNR_DP_TYPE_CD = #ownerDpType:VARCHAR#,<br> ATHR_PERS_NTL_ID = #authorId:VARCHAR#,<br> ATHR_PERS_SRC_ID = #authorSourceId:NUMERIC#,<br>
SBJ_AREA_ID = #subjectAreaId:NUMERIC#,<br> DP_GOAL_TYPE_CD = #goalTypeCode:VARCHAR#,<br> DP_JRNL_TITLE_TX = #title:VARCHAR#,<br> DP_JRNL_ENTRY_TX = #entry:CLOB#,<br></span> DP_JRNL_ENTRY_CMNT = #comments:CLOB#,<span class="q"><br>
DP_JRNL_CRTN_DT = #createDate:DATE#,<br> DP_JRNL_UPDT_DT = #modifiedDate:DATE#,<br> DP_JRNL_STRT_DT = #startDate:DATE#,<br> DP_JRNL_END_DT = #endDate:DATE#,<br></span> DP_JRNL_ACHV_DT = #achievementDate:DATE#</p>
<p> where current of c1;</p>
<p align="left"></p></font>
<p align="left">So, now, for the gold ring, how do I get rid of the 2 blank lines, one after 'set' and the second after 'DP_JRNL_ACHV_DT = ...' ?? The $if$ test when false seems always to generate a blank line.<br>
</p>
<p align="left">-David</p>
<p align="left"> </p></div>
<div><span class="e" id="q_11adf1476318779c_9">
<div><span class="gmail_quote">On 6/30/08, <b class="gmail_sendername">Johannes Luber</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:jaluber@gmx.de" target="_blank">jaluber@gmx.de</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">David Beckedorff schrieb:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span>Dear String Templaters,<br> I have a ST template that generates a SQL update statement::<br> dtoSqlMap(service,dto) ::= <<<br>
...<br>update $dto.tableName$<br>set $dto.fields : { f |<br></span> $f.dbColName$ = #$<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://f.name/" target="_blank">f.name</a> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://f.name/" target="_blank">http://f.name</a>>;format="ilc"$:$f.dbColType$#}; separator=","$ <== "ilc" means to format the initial letter lowercase<span><br>
where current of c1;<br>...<br> >><br> which in a specific case generates the following code:<br> update DP_JRNL_ENTRY<br>set<br> DP_JRNL_ENTRY_ID = #id:NUMERIC,<br> OWNR_PERS_NTL_ID = #ownerId:VARCHAR,<br> OWNR_DP_TYPE_CD = #ownerDpType:VARCHAR,<br>
ATHR_PERS_NTL_ID = #authorId:VARCHAR,<br> ATHR_PERS_SRC_ID = #authorSourceId:NUMERIC,<br> SBJ_AREA_ID = #subjectAreaId:NUMERIC,<br> DP_GOAL_TYPE_CD = #goalTypeCode:VARCHAR,<br> DP_JRNL_TITLE_TX = #title:VARCHAR,<br> DP_JRNL_ENTRY_TX = #entry:CLOB,<br>
DP_JRNL_CRTN_DT = #createDate:DATE,<br> DP_JRNL_UPDT_DT = #modifiedDate:DATE,<br> DP_JRNL_STRT_DT = #startDate:DATE,<br> DP_JRNL_END_DT = #endDate:DATE,<br> DP_JRNL_ACHV_DT = #achievementDate:DATE,<br> VER_NBR = #version:NUMERIC where current of c1;<br>
However, I want to suppress the DP_JRNL_ENTRY_ID and VER_NBR fields. The former is implied by "where current of c1" and the latter is updated by a trigger, so should be omitted from the update statement. But they are valid fields of the Data Transfer Object (DTO).<br>
It appears that the $if(...)$ construct allows to test for the presence of an attribute or the value of a boolean. But I don't think it allows to test for: if ( $f.dbColName$ == "DP_JRNL_ENTRY_ID" ).<br> Is there some other way to accomplish this?<br>
Thanks,<br>David<br></span></blockquote><br>Create a new attribute IsdbColNameJournalEntry.<br><span><br>Johannes<br></span></blockquote></div><br></span></div></blockquote></div>