Text File Input ignore line of tabs - pentaho

I have a job in Pentaho with a Text File Input step reading from a tab delimited text file. Sometimes when this file is given they have lines that are empty of data but the row is filled with tabs because they copied empty lines in excel. Below is a screen shot of the 'empty' rows in Notepad++.
Is there a way to ignore lines like this? I tried adding a filter entry with Filter string = number of tabs, Filter position = 0, Stop on filter = Y, Positive match = Y. This filter didn't seem to have any effect.
When the job runs it treats all of these as NULL records which makes sense but then this causes the next job a Table output to fail. If there is not a way to fix this with a text file input is there another job which can easily clean-up the bad records?

You can check one or more field values using Filter Rows.
Your transformation would look like: Text Input -> Filter Rows -> Table Output.

When I did more debugging I found out that the Filter tab did have the logic to achieve what I was looking for. Instead of Filter string = number of tabs, Filter position = 0, Stop on filter = Y, Positive match = Y it needed to have Positive match = N. After this change then it started working correctly.

Related

Filling in a column in SQL with a Case_when

So I have a column called censusbloccode2. I have just read this in from a fixed width file. The desired task is to have it to the following
If censusbloccode2 is blank then input a "0". If it has anything in it.. then leave it alone
When I broke up the fixed width text file... it is designated as a char (1) if that helps.
All of the search results that I have seen query this using a select.

SAP Smartforms dynamically change position of certain items

So I got this text of which I can't know the length beforehand because it depends on how many entries there are in an internal table (see below). The table is given to the Smartforms FM in my report. The text itself works fine with a dynamic text variable, but under that text I need a horizontal line. The Line needs to be right beneath the text at all time. So far I only got a line with a fixed position, which does not lead to the result I want.
If it is possible, how can I get the line to change position based on the length of the text? So that it is right under the text at all time, no matter how many lines the text got.
DATA: l_string TYPE string,
lt_stream_lines TYPE STANDARD TABLE OF string.
loop at i_tab.
* reading one line of i_tab into l_string.
APPEND l_string TO lt_stream_lines.
APPEND '' TO lt_stream_lines.
endloop.
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
EXPORTING
stream_lines = lt_stream_lines
lf = 'X'
TABLES
itf_text = gv_text.
* gv_text then has the full text I want to display
You must have a Main Window containing your Text element followed by a dummy Template element for the horizontal line (one empty cell with the top horizontal border in black color and other borders transparent).
Create a Template element via the context menu:
Draw the border (here I exaggerate the proportions "a little bit"!):
Preview result:

Calling to a different stimuli lists

I need to call to a different column with the stimuli depending on a previous given response. I.e. age
ask for age
if age = X --> choose a certain stimuli column (or a certain xlsx file)
What would be the basic procedure to do this. I am new in Psychopy.
Thanks a lot
Elena
You can add a field for age to the experiment info dialog box shown at the beginning of each session. Then you can refer to that value later in code as expInfo['age'].
Let's say you have two columns in your conditions file, labelled list_A and list_B, and you want to use either of those to put values into a text stimulus. In that text stimulus, put a variable called something like $text_list. Then in a code component, in the "begin routine" tab, put something like this:
if expInfo['age'] > 30:
text_list = list_A
else:
text_list = list_B
The same principles apply if you want to select between .xlsx files. Put a variable name in the conditions file file field of the loop dialog, and in some routine prior to the loop, set that variable to contain the desired filename.

Get the id of the selected value in a dropdown validation list on Excel in VBA

Using Excel, lets say I have a validation list made of 5 values like this one :
Patate
Tomate
Courgette
Concombre
Patate
In a cell containing a drop down list made of these 5 value, I select the fifth value : "Patate".
I want to get in VBA that this cell contains the 5th value of my validation list. Something like :
x = Cell.Validation.GetIDValueSelected
x = 5
I can't use Vertical search because I might have 2 or even more time the same value in my list (too long to explain why).
This list is also dynamics (depending of another sheets) so it doesn't always contains 5 values.
I hope I made it clear for everyone to understand my needs but I will be glad to add more information if needed.
Thank you for your time.
Sadly, once you have used DV to fill a cell with junk, there is no way to tell which piece of junk you picked:
You would have to pad each piece of junk with a different number of blanks.

Aligning Text that is output to file? Columns

I have some data which I run through, which generates a textfile.
The data is all pulled correctly, but it doesn't format correctly.
Right now, I am using TAB + Variable to space between each column but it is obviously made uneven as different variables differ in character length. Here is the layout:
RECORD NAME ADDRESS TELEPHONE SOMETHING SOMETHING
... Data is here.
Any ideas?
String.Format is your friend here.
It's very powerfull and gives you the function to align your output.
For example:
(EDIT: removed the txt prefix because could be confusing, now I suppose that data to be formatted is contained in string vars)
Dim result as string
result = String.Format("{0,-10}{1,-30}{2,-30}{3,-10}{4,20}", Record, Name, Address, Telephone, Something)
The result will be aligned to the left in a 10 space column for the first element (txtRecord) and so on for the remainders, the last element will be formatted in a column with 20 space and right aligned
If that's not enough look at composite formatting to get other useful options