Help with change in Data type
Moderators: chulett, rschirm, roy
Help with change in Data type
Hi All,
I have this job where i am getting 32 fields at the output . these fields later has to mapped to a fields in a table most of whose data types do not match with these .
well the data types of all the fields in the output are of type Varchar and of different lengths.
well some these should be changed to decimal of length 8 and few to int of length 4 .
and few to dates of length 8
well how do i change the data type from varchar to decimal of length 8 and varchar to Int of length 4 and the same to date of length 8?
well i tried using PROMO_ID:decimal[8,0]= decimal_from_string(PROMO_ID)
for changing from varchar to decimal of length 8 .
am i correct and how do i do for int and date?
Please need help on this
Thanks in advance
I have this job where i am getting 32 fields at the output . these fields later has to mapped to a fields in a table most of whose data types do not match with these .
well the data types of all the fields in the output are of type Varchar and of different lengths.
well some these should be changed to decimal of length 8 and few to int of length 4 .
and few to dates of length 8
well how do i change the data type from varchar to decimal of length 8 and varchar to Int of length 4 and the same to date of length 8?
well i tried using PROMO_ID:decimal[8,0]= decimal_from_string(PROMO_ID)
for changing from varchar to decimal of length 8 .
am i correct and how do i do for int and date?
Please need help on this
Thanks in advance
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
Look under the functions listed in the Transformer stage on the right click menu. The subfolder of type conversions should help you out. You can always read the .pdf under your Start menu for more descriptions.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
In server it does not matter. In px it does. If you have any background in programming, especially c, you will know that characters are not the same as integers. They need typecasting to be changed from one form to another. Similarly with PX, as it is strongly typed like C, you need the conversions. Thats why these functions exist in the first place.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
Thanx.DSguru2B wrote:In server it does not matter. In px it does. If you have any background in programming, especially c, you will know that characters are not the same as integers. They need typecasting to be changed from one form to another. Similarly with PX, as it is strongly typed like C, you need the conversions. Thats why these functions exist in the first place.
Last edited by Krazykoolrohit on Thu Jan 18, 2007 2:38 pm, edited 1 time in total.
Because PX is strictly data typed. You must promote or demote accordingly. As for not have the Transformer, the only reason would be that your compiler is not configured. You can use the Modify stage, but you'll find that while a much faster stage, it is less "friendly" because of it's obvious manual typing effort.
The Transformer stage has made significant strides in flexibility and functionality. It's more legible and easier to understand and use. In the new few releases I'm confident engineering will get it to the point of matching the Modify in terms of performance. Unless you're counting microseconds and are concerned about significant accumulation of microseconds, consider the Transformer stage.
The "Rule of Thumb" to never use the Transformer stage in favor of Modify stage should be carefully reviewed on a case-by-case basis. The Modify stage cannot replace the Transformer stage all situations.
The Transformer stage has made significant strides in flexibility and functionality. It's more legible and easier to understand and use. In the new few releases I'm confident engineering will get it to the point of matching the Modify in terms of performance. Unless you're counting microseconds and are concerned about significant accumulation of microseconds, consider the Transformer stage.
The "Rule of Thumb" to never use the Transformer stage in favor of Modify stage should be carefully reviewed on a case-by-case basis. The Modify stage cannot replace the Transformer stage all situations.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Slightly off topic, the decision about Transformer versus other stage types is also a function of version. Somewhere in version 7.1 Transformer stage performance was enhanced, and can now be preferred to Filter or Switch (for example) which are effectively interpreted rather than compiled. However, Modify stage is still best for the things that it can do - it's very primitive nature is the secret of its speed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.