Focal Point
Using a define to reformat a field

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

September 13, 2004, 03:22 PM
<Leah Bell>
Using a define to reformat a field
I am filtering on two fields but am receiving an error message when I try to run the report. The error says it is a problem with the format of the fields I am filtering on.
How do I reformat the two fields?
Would you create a Define and use the edit function to do this? If so, how do you pull in the new edited field from the define into the filter?
September 13, 2004, 03:49 PM
webfocuspgm
Could you post a code example and version you are working with...? I use the Define/Edit all the time but there can be tricks especially when working with date fields.....

Maybe one of the guru's can offer assistance but some of us newbie's need more info.
September 13, 2004, 04:08 PM
<Leah Bell>
I am using WebFocus Developer Studio 52. I have been using report painter and the gui interface to create the report really and haven't actually been writing any code into it myself. But what I am trying to do is change the format of a date/timestamp field to the YYMD format. I was thinking that I might could change the format from the MDYY that it is in in the database to the above format using a define in the procedure pane and the edit function. I think that if I can accomplish this it will solve my problem I am having when trying to run the report with the filter on the above date. currently I am getting an error message about the format of the date in the field I am tryin to filter on. I guess I would be doing something like EDIT (<field name>, "YYMD")? I haven't been able to get it to work yet though. Also, once it is reformat properly do you know how to pull the defined filed into the filter. I don't see where I can pull that in in the where clause interface if it is a defined field.
September 13, 2004, 05:49 PM
reFOCUSing
Try using HDATE or HPART.

field2/SDfmt = HDATE (DTfield, format);
field2/Afmt = HPART (DTfield, 'unit', format);

I like HDATE the best because it needs less input values.
September 14, 2004, 05:48 AM
Piipster
Could you please show us the the exact filtering statements and the formats of the fields you are filtering on? You may not need to change the format of the fields you are testing.

Let us know.