I want to use variable in 'Generate rows' step in Pentaho. How can i use it. I want to give a file path in a 'Value' field but that should not be static so that i can pass this value into my csv input.
I am not sure to understand your question (see #mat's comment), but as far as I can understand it, I wonder if you really need a Generate Rows.
The CSV Input File can read the file name from a variable. If you look near this field you'll see a small 'S' in a blue diamond shape. It means that you can put a variable in it, in the format ${var_name}.
This suppose that your variable is indeed a variable, as opposed to a field. You can get the list of variables by pressing on Ctrl+Space on any input box near the 'S' in blue diamond shape. You can add a variable either in defining in a previous job, either in the parameter list [Right-click anywhere and select Parameters], either by editing the kettle.properties [on the top menu Edit], either by specifying the variable value on the small panel that is presented to you each time you want to run a transformation.
With a Generate Rows, you define a field and there is no way to use a field for the filename in a CVS Input file. You can however use a field in a Text file input with the Accept file name from an other step check box, and telling spoon from which step and from which field. If you use this step, specify on the Content tab that the filetype is CSV.
you can use "for" javascript lang step and get variable to generate rows,
Related
Hello I want some help with a code to search through the text file and to separate the text from a separator value followed by a rogue(stopping) value.
Each line of text in the text file is: for example with sample data:
DAC11010|This is a Desk and a chair|$100;.
In the above example has the | sign as a seperator value and ;sign as a rogue(stopping) value. The separator value separate the text DAC11010 , This is a Desk and a chair , $100 the rogue(stopping) value means that it it is the EOLN(end of line) and ready to check the next line.
The separated text goes to 3 ListBoxes and the data added one after the other. The DAC11010 goes to the lstItemCode , This is a desk and chair goes to the lstDescription , $100 goes to the lstPrice.
I would like if someone would volunteer to help me program the code in vb.net. I hope I made myself clear.
Thank you [shannon].
If you haven't already done so, please turn on Option Strict. This is a 2 part process. First for the current project - In Solution Explorer double click My Project. Choose Compile on the left. In the Option Strict drop-down select ON. Second for future projects - Go to the Tools Menu -> Options -> Projects and Solutions -> VB Defaults. In the Option Strict drop-down select ON. This will save you from bugs at runtime.
I will not write the code for you. That is not the purpose of Stack Overflow. We help with specific problems you are having with your code. You don't appear to have any code.
I will explain one way your goal might be accomplished.
Declare 3 New List(Of String) variables to hold the data for the three list boxes. We will be looping through the text files lines but we don't want to update the user interface until after the loop so we will collect the data in memory.
You will need to import System.IO to use methods of the File class. You can use File.ReadAllLines to get an array of strings; each member of the array will contain one line from the text file.
Next, you will want to loop through the lines splitting each line into 3 sections. Use the For Each...Next type of loop. You can use the String.Split method passing in your "|"c parameter. The c tells the compiler that this is a Char not a string because .Split is expecting a Char Now you can use the .Add method to add the sections to the appropriate list.
After the loop, you can assign the 3 list to the .DataSource property of the appropriate ListBox.
Now write the code and if you have any problems ask a new question showing the specific code where you are having the problem.
In a LibreOffice writer document with a field of #temperature_farenheit. Is there a way to create a field named #temperature_celcius that would automatically calculate and insert the correct temperature?
And if this is possible, what types of fields do I use and how do I reference them for purposes of calculations.
This can be achieved with user variables. I'll give a start-to-finish example in painful detail for clarity, and hopefully universal applicability to other cases.
Open a new text document.
Enter some text like Water boils at °F (°C).
Put the cursor before °F where you would normally type the number.
From the menus, choose Insert→Fields→More Fields…
Go to the Variables tab. Choose Type: User Field.
Below that, you'll see each User Field gets a Name and a Value. It will not appear in your document, but enter a Name for this variable we're using to store "water's boiling temperature in degrees Fahrenheit," lets say: BoilF
Enter the Value you want stored in that variable, and accordingly shown in this field in the actual document text. Here, its: 212
Click the Insert button to actually add the field to your document. You should see 212 appear in the text.
You've now added the field, but also created a variable that can be used elsewhere. Now to do the math and use it elsewhere:
Leaving the Fields window open, put the cursor before °C.
In the Fields window, select Type: Insert Formula.
Below that, enter the Formula: (BoilF-32)*5/9
Click the Insert button. You should see 100 appear in the text.
Should you ever need to update a number pair, double-click the first number—that is, the User Field in your text. Example steps, using the above starting point:
Add to the sentence so it reads
Water boils at 212°F (100°C) atop Everest.
It's now wrong, so double-click 212.
The Edit Fields window will appear. In the Value box, enter 154.4 and click the OK button. It will do the math and both temperatures will update in the text.
Water boils at 154.4°F (68°C) atop Everest.
Be mindful of variable names. If you have 20 temperatures scattered through your text, you should in turn have 20 user variables, with thoughtfully-chosen names.
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.
I have a file names.txt with this data:
NAME;AGE;
alberto;22
andrea;51
ana;16
and I want to add a new column N with the line number of the row:
N;NAME;AGE;
1;alberto;22
2;andrea;51
3;ana;16
I've been looking and what I found was something related with Add sequence. I tried but I don't know how.
Thank you very much.
The Add Sequence step will get the job done, but you don't even need that. Both the CSV file input and Text file input steps can add a row number to the input rows. For the 'CSV file input' step it's called 'The row number field name (optional)'.
For Text file input, check the 'Rownum in output?' box on the Content tab and fill in the 'Rownum fieldname' text box.
I'm really baffled why you couldn't figure out the Add sequence step. It should work with no changes at all. Just drop it in and connect the output of the csv file to it and the sequence should appear as a field name called 'valuename'. I would change that personally, but still, it should work.
I am using the "Download File" action in Install4j, and I need to use a variable in the text field where you specify the URL from which to download the file. I know that I can use a variable like this: ${installer:codebase}. However, I need to append the file name onto the end of that variable. Does anyone know how to do that?
I have tried ${installer:codebase}filename.jpg and ${installer:codebase}+filename.jpg, but neither seem to be working.
Installer variables are simply replaced in text properties. For example, if you set it to
${installer:codebase}/filename.jpg
and the value of "codebase" is set to "http://mycorp.com", then the text after replacement will be
http://mycorp.com/filename.jpg