Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

format change for field

Former Member
0 Likes
935

I am having a field of char type with the format

9/1/4519 I want its value to be 9\1\4519 otherwise it is creating problem in excel sheet.

how to do it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
818

use REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].

hope will work

5 REPLIES 5
Read only

Former Member
0 Likes
819

use REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].

hope will work

Read only

Former Member
0 Likes
818

Here is the example

see to it..

DATA: T(10) VALUE '9/02/2008',

STRING LIKE T,

STR1(4) VALUE '/',

STR2(4) VALUE '\',

STR3(2) VALUE 'kl',

STR4(6) VALUE 'klmnop',

LEN TYPE I VALUE 2.

STRING = T.

WRITE STRING.

REPLACE STR1 WITH STR2 INTO STRING.

WRITE / STRING.

The output appears as follows:

9/02/2008

9\02\2008

Regards

Manish.

Read only

Former Member
0 Likes
818

demo code for replace:

DATA: T(10) VALUE 'abcdefghij',

STRING LIKE T,

STR1(4) VALUE 'cdef',

STR2(4) VALUE 'klmn',

STR3(2) VALUE 'kl',

STR4(6) VALUE 'klmnop',

LEN TYPE I VALUE 2.

STRING = T.

WRITE STRING.

REPLACE STR1 WITH STR2 INTO STRING.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR2 INTO STRING LENGTH LEN.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR3 INTO STRING.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR4 INTO STRING.

WRITE / STRING.

The output appears as follows:

abcdefghij

abklmnghij

abklmnefgh

abklghij

abklmnopgh

Read only

Former Member
0 Likes
818

Hi,

before processing it into Excel sheet. Loop the intenal table and chage that particular field as.

replace all occurrences of '/' in field name with '\'.

modify the internal table by transfering the field.

Thanks,

Arunprasad.P

Read only

Former Member
0 Likes
818

hi,

try out this . this will transalte every occurance of / with \

data: a(8) type c.

a = '9/1/4519'.

TRANSLATE a USING '/\'.

write : a.

reward points if useful and and mark the post answered if u got the solution .....