- Posts: 1
Export Data where the new column headers are in rows
- George
- Topic Author
- Offline
- User
Less
More
13 years 4 months ago #2133
by George
Export Data where the new column headers are in rows was created by George
Hi Guys
I need some help please.
I am trying to import the attached file and export it to a TXT format so I can then import it into my ACT! database.
The problem I have is:
1. The columns headers (for the output file) are in rows separated by colons, and the value of the data is in the same row.
2. The email addresses at the beginning of each enquiry; i need flowheater to pass it and not import it.
If someone could please assist that would be great
George
I need some help please.
I am trying to import the attached file and export it to a TXT format so I can then import it into my ACT! database.
The problem I have is:
1. The columns headers (for the output file) are in rows separated by colons, and the value of the data is in the same row.
2. The email addresses at the beginning of each enquiry; i need flowheater to pass it and not import it.
If someone could please assist that would be great
George
Attachment test.txt not found
Attachments:
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Offline
- Admin
13 years 4 months ago #2134
by FlowHeater-Team
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Replied by FlowHeater-Team on topic Re:Export Data where the new column headers are in rows
Hi George,
This challenge is possible but a bit tricky
First you need one GroupBy Heater for group all email rows to one row. To determinate each email we need an additional .NET Script Heater and the following little script.
The Script checks each line. If the line contains the string "From:" then we have a new group or a new email.
Second we need to fill the columns with the certain field parts. For this you have to use for each column you want to export the IF-THEN-ELSE Heater and the String Split Heater .
The Split Heater splits only each line into 2 Parts using the delimiter ": "
e.g. Email Address: hottie@hot.com
First part: Email Address
Second part: hottie@hot.com
In the IF-THEN-ELSE Heater you have to specified for each column a condition like this
** Email Address
Note: ** is the InString operator!
If the condition match the Value goes out from the IF-THEN-ELSE Heater to the column "Email Address".
To demonstrate this I have made an example; please have a look to the attachment.
Hope this helps
This challenge is possible but a bit tricky
First you need one GroupBy Heater for group all email rows to one row. To determinate each email we need an additional .NET Script Heater and the following little script.
Code:
int nGroupCount = 0;
public object DoWork()
{
if (InValues.Length != 1)
throw new Exception("1 Inputparameter expected");
// get the first input parameter
string sIN = (string)InValues[0].GetString();
if (sIN == null)
return nGroupCount;
if (sIN.IndexOf("From:", StringComparison.CurrentCultureIgnoreCase) >= 0)
{
// if we found the string "From: " in the line we have a new group
nGroupCount++;
}
return nGroupCount;
}
The Script checks each line. If the line contains the string "From:" then we have a new group or a new email.
Second we need to fill the columns with the certain field parts. For this you have to use for each column you want to export the IF-THEN-ELSE Heater and the String Split Heater .
The Split Heater splits only each line into 2 Parts using the delimiter ": "
e.g. Email Address: hottie@hot.com
First part: Email Address
Second part: hottie@hot.com
In the IF-THEN-ELSE Heater you have to specified for each column a condition like this
** Email Address
Note: ** is the InString operator!
If the condition match the Value goes out from the IF-THEN-ELSE Heater to the column "Email Address".
To demonstrate this I have made an example; please have a look to the attachment.
Attachment rows_to_columns.zip not found
Hope this helps
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Attachments:
Please Log in or Create an account to join the conversation.
Time to create page: 0.266 seconds