Skip to main content

I have two sql tables.

One contains inspection records as shown:

The other contains questions for each inspection as shown:

I need to combine these and put them in access as such:

InspectionID; InspectionName; Date; InspectedBy; Old_Spill_ID; Spill_Type; etc.

Any help is much appreciated!

Hi,

I would read one of the tables via a reader and use a joiner to add the records of the second table.

After that it a matter of attribute renaming, deleting and such that can be managed via the attribute manager.

Hope this helps.


You can read both tables and use the FeatureMerger (merge on InspectionID). Use the Inspection table as supplier and the Questions table as requestor. The Merged out put will be the data of the questions with the information of the Inspection added.


Another way of doing this is using the SQLCreator.

This transformer will take a SQL statement as the source for your FME Workspace.

The SQL would be something like:

Select * from Questions Q, Inspections I where Q.InspectionID = I.InspectionID


Hi,

I would read one of the tables via a reader and use a joiner to add the records of the second table.

After that it a matter of attribute renaming, deleting and such that can be managed via the attribute manager.

Hope this helps.

I tried reading the inspections table and joining the questions and ended up with 36 records - one for each question. Then tried reversing it reading the questions and joining the inspections - didn't get that to work.

 

 


You can read both tables and use the FeatureMerger (merge on InspectionID). Use the Inspection table as supplier and the Questions table as requestor. The Merged out put will be the data of the questions with the information of the Inspection added.

if I have 36 questions wouldn't this give me 36 results? I'm looking for on result containing all the inspection info and all the questions/answers.

 

 


Another way of doing this is using the SQLCreator.

This transformer will take a SQL statement as the source for your FME Workspace.

The SQL would be something like:

Select * from Questions Q, Inspections I where Q.InspectionID = I.InspectionID

Don't know much about SQL but have looked at it. One problem is that two questions are the same but have different answers: person contacted - Y/N and person contacted (given name). SQL doesn't like that in the select statement.

 

 


It seems to me that you want to use the value of the QUESTION column in the second table as the name of a field added to the first table, with the value of the ANSWER column in the second table.

That's sort of easy enough, as long as the values of the QUESTION column are known in advance and can be manually defined in the output schema.

What you need to do is add an AttributeCreator transformer and set it up to create a new attribute called @Value(QUESTION) with the value of @Value(ANSWER)

See the attached workspace:

Then merge the two together using a FeatureMerger and write the data out to the known fields.

I'm using Excel instead of Access, and shortened a few of the attribute names to make it quicker for me, but it should work for you.

Regular FME'ers will notice the odd attribute name under the FeatureMerger, and red connections in the output. It seems to work OK and write those values, even though they aren't exposed in the workspace.

Hope this helps. You can download the workspace as a template from here.

Mark


It seems to me that you want to use the value of the QUESTION column in the second table as the name of a field added to the first table, with the value of the ANSWER column in the second table.

That's sort of easy enough, as long as the values of the QUESTION column are known in advance and can be manually defined in the output schema.

What you need to do is add an AttributeCreator transformer and set it up to create a new attribute called @Value(QUESTION) with the value of @Value(ANSWER)

See the attached workspace:

Then merge the two together using a FeatureMerger and write the data out to the known fields.

I'm using Excel instead of Access, and shortened a few of the attribute names to make it quicker for me, but it should work for you.

Regular FME'ers will notice the odd attribute name under the FeatureMerger, and red connections in the output. It seems to work OK and write those values, even though they aren't exposed in the workspace.

Hope this helps. You can download the workspace as a template from here.

Mark

This works well with the exception that I run into issues with special characters (parenthesis, periods, etc.) in access. How would I expose and reword (rename) the questions?

 

 


This works well with the exception that I run into issues with special characters (parenthesis, periods, etc.) in access. How would I expose and reword (rename) the questions?

 

 

I think a SubstringReplacer (before the AttributeCreator) is the first thing I'd try.

 

 


Reply