Hi all, Just wondering if you can help me. I have a DB with 2 columns in it, "filename" & "sql_statement". I am reading one row from this DB and I want to assign the output to context variables I have created "con_filename" & "con_contents". I want to then create a file using the value I have stored in "con_filename" and the file being created should be populated with "con_contents". At the moment I'm selecting the data from the DB fine using a tPostgresqlInput I am trying to assign the output to context variables here too using a tJavaRow. tJavaRow contains the following. //Code generated according to input schema and output schema output_row.filename = input_row.filename; output_row.sql_statement = input_row.sql_statement; context.filename = input_row.filename; context.sql_statement = input_row.sql_statement; I am then outputting directly to a tFileOutput but I'm getting both values into the file and a null file name. It appears that the context variables never get set. How do you assign values to context variables. Thanks in advance,
Hi Dave how many records are fetched from your DB select query? If its more than 1, check if the last record gives a null or blank values. The reason is that you are assigning the values to context in a flow. So for each record processed, the values of context changes. Hope it helps you. It will be better if you put a screen shot.
hi, If you are using context variable to store some value from flow is not a 'best practices' even if it can work as lijolawrance said in fact the only value that you have is the lasted one into your context For that use globalMap and a flowToIterate to catch value from the flow (have a look into codeViewer to be sure about the name (key map) of globalMap var). It's always 'rowName.fieldName' (ex : row1.firstName) hope it help
In reply to your question though LijoLawrance, I am reading in just the one row does this help my cause in making it easier. The value that is being read in is a dynamically changing filename that is created in postgresql. regards,