I have two string fields of unspecified length, lets call them One and Two. Now I would like to concat them, so that if One = "aaa" and Two = "bbb" the result becomes "aaabbb". Using the Concat fields step seems like a reasonable first guess for how to do this.
However, if I leave the "Length of target field" setting with the standard value of 0 I get no output. If I set it to something large, like 100, I always get extra spaces at the end. I want the resulting field to be as long as necessary to contain One + Two, not longer and not shorter. Is there anyway to do this using this step or some other one?
I have tried using the trim setting, but it trims the input and not the output. Clicking the "Minimal width" button does absolutely nothing.
This seems like it should be a pretty simple standard task. Am I missing something here?
EDIT: My input here is just a few rows from a Data grid step, without anything between the grid and the concat. I tried replacing the grid with a Generate rows step, but I get the same result (both when using fixed length for the generated fields, and when leaving the length fields blank).
My version of Kettle is 5.4.0.1-130. I am running it on a Windows 7 x64 platform.
Do the configuration as shown in the figure. It correctly gives the result as the second figure.
Result:
Used Data Grid step to get data.
The configuration suggested by Marlon Abeykoon works. It also works with type "String" instead of "None".
My problem was not in the Concat fields step, but the Text file output step I used to write the result to a file. It takes its metadata about the fields from the Concat fields step, and inherits the zero length for the field therefore printing zero characters to the text file.
The solution is to go to the "Fields" tab of the output step, and there press "Get fields". That explicitly adds all the fields and their metadata to the list, so you can change the lenght field of the output field from the concat step to be empty instead of 0.
Related
I want get all values of dropdown and want to store them somewhere. from follwing NASDAQ site https://www.nasdaq.com/symbol/ge/historical i want get all values of Timeframe and want to somewhere so that i can use those values one b one in loop and get the values of stock for all timeframe. Click below image screenshot
It's not that easy to get each of the values, but it's not impossible. First you can get all the values in a Data Item as text. If you spy the element, you will notice that the attribute Value contains what you want. So you will need to use a read stage and get this specific attribute's value (you can ignore the PDF elements):
Doing so will give you the following:
The problem with this is that you cannot use this in a loop. One way around would be to split on space:
And the resulting collection (I called it Split Values) will look like this:
But it's not quite there yet. You should however be able to use this collection to get the collection you need (or use it directly).
If you use it directly, I would say it should look like this:
Empty? has the expression [Split Values.words]="" (notice the last row is blank)
Value is number has the expression IsNumber([Split Values.words])
Set Current Item as Number has expression [Split Values.words] with store value Current Item.
Append word to Current Item has expression [Current Item]&" "&[Split Values.words] with store value Current Item.
I'm working on a small Project using Primefaces.
I'm trying to display value from my database with special formation
I store a String in my database which Looks like this 40;99;1;0;0;12
These are six different numbers seperated with a ;and they have a range between 0-99.
I want to display this value in an InputMask to make sure that the user doesn't forget the ;.
Now I have a problem with the format.
I'm using this
<p:inputMask id="myID" placeholder="Value" value="#{myClass.value}" mask="9?9;99;99;99;99;99"/>
I'm trying to say that the mask contains six "fields" for a number input and each field can contain a number between 1-99.
The problem is if the user writes the input as this 30;10;0_;0_;0_;4_Primefaces converts it to 30;10;00;04;__;_
Is there a good way to let the mask know that it can be a number with one or two digits?
Or is there a way to say, if input has just one digit put a 0 first
I dont know if this solution fits your needs, but you can define a custom mask
$.mask.definitions['h'] = "[0-9]{0,1}";
$("#form\\:your_input_mask_id").mask("hh;hh;hh;hh;hh;hh");
in your document.ready function. This will leave the _ character as is, but I guess you can handle it in your code when splitting the string and handling each part. I've put form\: because you generally put these inputs inside a form with id form. Change accordingly!
This has the downside though, that if you dont enter something, it will also validate, regardless of not being between 1 and 99.
I have some data with 15 variables, including some missing values. When I tried to look at the Frequency charts with the count and percentages of missing values, it was showing all variables without any missing values. In the variable view, I changed the "Missing" column from "None" to "Discrete" missing values, which was "?" to include the missing values. This showed the correct numbers of missing values for each variable.
I then went to Transform > Replace Missing Values to replace these missing values, but the only variables that appear as an option are the variables that are not missing any values. I tried going back to the variable view and changing all of the "Missing" column values back to "None" from "?", but that didn't help.
All of the variables that do appear in the Replace Missing Variables box are also numeric. Is that the problem - that the variables I want to replace are strings? If so, how can I handle these missing string values in my data?
The dialogue you are discussing is for imputation techniques for missing data. Such as the mean or the median of the series or nearby points (the specific command is RMV) and so it is only applicable for numeric data.
One way to replace missing values for string variables is to use the RECODE command, example shown below.
DATA LIST FREE / X (A5).
BEGIN DATA
A
B
?
C
?
END DATA.
MISSING VALUES X ('?').
RECODE X (MISSING = '!').
I have : <xp:repeat id="repeatColor" value="#{productcolors}"
var="rowData" indexVar="rownum" >
PROBLEM : rownum goes from 0 to the last correct value, but rowData is always the same
This repeat control is bound to a view "productcolors" , a view with a key on product code.
This view has a first column with the product code , ascending (for the key).
It also has a second and a third column with ascending multiple value fields.(second is framecolor, third is upholstery color)
The idea is that the repeat control goes through the different colors for the selected product, but it only shows the first one and does that the number of times (rownum increases correctly)that there are colors for the selected product.
EDIT :
So I have for example a product called "A" available in framecolors "1" "2" and "3"
When I am using the repeat control rownum changes from 0 to 2 but rowData is always the reference of framecolor "1". I don't know why rowData isn't changing.
When I use rowData.getUniversalID() I am getting 3 times the ID of the document containing the multiple value field with the 1 , 2 and 3 in it, which is I guess normal ? But how can I get a handle to those different values inside it ?
SECOND EDIT
I tried :
var testje:string = rowData.getUniversalID();
var db:NotesDatabase = session.getDatabase(database.getServer(),"product/colors.nsf");
var doc:NotesDocument = db.getDocumentByUNID(testje);
test = doc.getItemValueString("colorUpholstery");
The result is that "test" only holds the first item of the multiple value field "colorUpholstery" .
How is that possible ? I thought I would get the complete value of the "colorUpholstery" field ?
Maybe because I only have reader access(Publicaccess) to the colors.nsf database ?
It would be nice to see a little more code... like what's inside the repeat.. just to get a better feel for it to go along with your description of the Notes View.
rowData should be an XSPViewEntry... basically a NotesViewEntry... I suggest you first do something like rowData.getDocument().getUniversalId() to make sure it is iterating the documents correctly. I'm sure it is.
It sounds like you're trying to do something with a multi-value field.. are you also setting the view to use display multiple values as row entries? or whatever that setting is? That might get dicey if that's turned on. Not sure.
Again I'm not totally following what what the goal is but I would first test to make sure it is actually repeating the expected documents. then it's all about fine tuning.
EDIT: Ok... some thoughts based on your additional info:
I suspect that your problem is the use of the view setting "show multiple values as separate entries". Each is the same document really. So that's likely not helping you here. I'm still a little fuzzy on exactly what you want for the output. Is this from a "view page" of maybe products? a "form page" of a single product?
I ASSUME you want all the colors for a single product? And this is a lookup view right? so you're on your product "document" and now you want to list all the colors?
Assuming so...
Use SSJS and the object model. Do a lookup to find the SINGLE document that has the multi-value color field for your current product. then return to a repeat control something like:
lookupDoc.getItemValue("colorField")
I'm not 100% sure that's the correct syntax. The point is you can send a multi-value field to a repeat control and it will repeat it. Much easier then trying to use view tricks.
If your goal is to have a Repeat of multiple products.. and in side each "row" to show all the available colors then you're looking to have a nested repeat really... The outer repeat (outerData) to iterate over all the main products and inside that another repeat (innerData) for the colors. Inside that repeat code you use the "outerData" to get the multi-value field. Something like:
outerData.getDocument().getItemValue("colorField")
Assuming I'm understanding you correctly these are my suggestions.
I did do an example of nested repeats like this on an early NotesIn9. I believe it was this one: http://notesin9.com/index.php/2010/03/30/notes-in-9-show-14-repeats-repeated/
Maybe that will help.
Second Edit Response:
Based on the code you added you're using "doc.getItemValueString()" By design that will only get you the first value of a multi-value field. This is the same as saying in LotusScript:
doc.colorUpholstery(0)
or the less commonly used
doc.getItemValue("colorUpholstery")(0) ' I might have that wrong. I never really used it
Again if you want to make a list of all the colors I'd use a repeatControl and pass in:
doc.getItemValue("colorUpholstery") then your "rowData" for that repeat will be each value. I've seen others avoid the repeat and doing some javascript explode or implode type thing I believe. using "\N" or something as a separator for a new line. I just use a repeat. Easer for me to understand.
Again I THINK everything you need really is in NotesIn9 episode 14.
I have the list with like 100,000 site link strings
Each link is unique, but it has consistent ?Item=
Then, it's either nothing or it continues after & symbol.
My question is: How do I pull out the item numbers?
I know replace function can offer similar functionality, but it works with Fixed sizes, in my case string can be different in size.
Link example:
www.site.com?sadfsf?sdfsdf&adfasfd?Item=JGFGGG55555
or
www.site.com?sadfsf?sdfsdf&adfasfd?Item=JGFGGG55555&sdafsdfsdfsdf
In both cases I need to get JGFGGG55555 only
If this always is the last portion of the string, you can use the following:
=MID(A1, FIND("?Item=", A1) + 6, 99)
This assumes:
no item numbers will be over 99 digits.
no additional fields follow the item number.
Edit:
With the update to your question, it is apparent you have some strings with additional data after the ?Item= field. Without using VBA there is not a simple means of using MID and FIND to extract this.
However you could create a column which acts as a placeholder.
For example, create a column using:
=MID(A1,FIND("?Item=",A1)+6,99)
This gets you the following value: JGFGGG55555&sdafsdfsdfsdf
Next, create a column using:
=IF(ISERROR(FIND("&",B2)),B2,LEFT(B2,FIND("&",B2)-1))
This produces: JGFGGG55555 by searching the first value for a & and using the portion before it. If it is not found, the first value is simply repeated.
This formula should work for both the examples given:
=MID(A1,FIND("=",A1),IFERROR(LEN(A1)-FIND("&",A1,FIND("=",A1))-1,LEN(A1)+1-FIND("=",A1)))