Focal Point
varchar vs tx fields

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6101006122

April 03, 2007, 02:17 PM
Pam Kratt
varchar vs tx fields
We have a field on our database that is defined as varchar 2000. In our master, it is defined as TX50 and TX.

When we execute the following code the draft1 field is always 0 even if the condition should cause it to be 1. We are NOT displaying or using the varchar 2000 byte field so it took me a bit to figure out the issue. What is happening is when we display the entire file, one record is appearing as 5 rows in the output because of the varchar field (there is about 200 characters in the varchar field and since we have it defined as TX50, it goes to 5 lines). I believe my define is looking at the last "line" of my 1st record and seeing blanks for both fields and setting my define to 0. If I change the varchar field to be A200 in my master, the entire record appears on only 1 line and the define works.

What is the best way to define a varchar in the master?
Is there some other setting I should by entering so that my define will work when the field is defined as TX50?
I thought TX50 was how it should be done so that wrapping, etc could be done with the field.

I also tried doing the calc as a compute instead of a define and I got the same result if I left the field as TX50.

Thanks.

DEFINE FILE FOLLOW_UP_INFO
DRAFT1/I2=IF (FOLLOW_UP_RESPONSE NE ' ' AND FOLLOW_UP_COMPL_DT IS MISSING) THEN 1 ELSE 0;
END

TABLE FILE FOLLOW_UP_INFO
PRINT ACCOUNT_NUM FOLLOW_UP_RESPONSE FOLLOW_UP_COMPL_DT
DRAFT1
WHERE ACCOUNT_NUM EQ '123456'
END


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
April 04, 2007, 08:37 AM
hammo1j
As a quick workaround define wf fields with different formats based on the same alias in the database.

eg

FIELD=FOLLOW_UP_RESPONSE_V,ALIAS=FUR,A2000V,A2000V,$
FIELD=FOLLOW_UP_RESPONSE_TX,ALIAS=FUR,TX50,TX,$

Use one for the define test and one to print. I use this technique all the time without problems.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
April 06, 2007, 11:06 AM
FrankDutch
that's a usefull tip H..




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 09, 2007, 09:11 AM
jgelona
This is also a good technique for datetime fields. For example, consider the following:

FILE=kdsassgn, SUFFIX=SQLORA,
SEGNAME=TASSIGNM, SEGTYPE=S0,$
FIELD=AS_ASGNID , ASGN_ID , I8 , I4 ,$
FIELD=AS_BEGDT , STRT_DT , YYMD , DATE ,$
FIELD=AS_BEGDTTM , STRT_DT , HYYMDS, HYYMDS ,$
FIELD=AS_ENDDT , END_DT , YYMD , DATE , MISSING=ON,$
FIELD=AS_ENDDTTM , END_DT , HYYMDS, HYYMDS, MISSING=ON,$
FIELD=AS_STAFF_NM , D_STF_PERS_NME , A80 , A80 , MISSING=ON,$

The STRT_DT is a system date, so they are pretty much guaranteed to be unique when considering time down to the millisecond. To find the most recent assignment for a each Staff person,

TABLE FILE KDSASSGN
PRINT AS_ASGNID AS_BEGDT AS_ENDDT
BY AS_STAFF_NM
BY HIGHEST 1 AS_BEGDTTM NOPRINT
END


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
April 09, 2007, 09:27 AM
mgrackin
The TX format is the old why of handling long character fields from RDBMS's. The A format was increased some releases ago to handle long character formats. The TX field format has some limitations besides the behavior of breaking a field value into multiple records. I have found that using the Annnn format is best. I have not done any testing to see if there is a significant advantage to including the V on the end of the format or not (AnnnnV).

In general, I would recommend using the Annn[V] format instead of the TX. In addition, you can set you WebFOCUS server to create Annnn[V] format fields instead of TX format fields when creating synonyms (MFDs).


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011