Extract word between two words in Tableau - tableau-api

My data in a single column looks like this
Environment: PROD_A
JobName: MY JOB NAME 1
MemName: Some_Script_names
My aim is to create a calculated field where it fetches JobName.
In above sample. The output should be MY_JOB_NAME_1
Here's my code in Tableau -
MID([Description],FIND([Description],"JobName: ")+9,
FIND([Description],"MemName: ")-FIND([Description],"JobName: ")-9)
The above logic is same as excel function below. It basically finds first word and last word and then picks the one in between.
=MID(A1,SEARCH("JobName: ",A1)+9,SEARCH("MemName",A1)-SEARCH("JobName: ",A1)-9)
Issue -
Tableau is showing blank data. Not sure where my logic is wrong. Any help is appreciated.

You may be able to use REGEX funtions (depending on your data source). Try this: REGEXP_EXTRACT([Data],'JobName: (.*)')

I see that you commented that the text is in one cell and not one column as you wrote in question.
This finds the JobName and uses that position plus the lenght of it as the startposition, then finds MemName as the endposition (and calculates the number of characters between them)
=MID(A1,FIND("JobName: ",A1)+LEN("JobName: "),FIND("MemName",A1,FIND("JobName: ",A1)+LEN("JobName: ")+1)-(FIND("JobName: ",A1)+Len("JobName: ")))

The following tableau calc works, this assumes that there is no space after MY_JOB_NAME_1 and "MemName:"
MID([Text],
FIND([Text],'JobName: ')+10,
FIND(
MID([Text],
FIND([Text],'JobName: ')+10)," ")-9)

Related

How to vertically list all days of the month in Google Sheets

With Populate a Full Month’s Dates Based on a Drop-down in Google Sheets how to I was able to list all days of a month next to each other.
=TRANSPOSE(ARRAY_CONSTRAIN(ArrayFormula(date($A$1;MONTH(A2&1);1)+transpose(COLUMN($C$1:$BK$1)-3));DAY(EOMONTH(date($A$1;MONTH(A2&1);1);0));1))
What do I need to change in the current formula to list them below each other?
I am going to take a wild guess and say Erase the word "transpose()"
=(ARRAY_CONSTRAIN(ArrayFormula(date($A$1;MONTH(A2&1);1)+transpose(COLUMN($C$1:$BK$1)-3));DAY(EOMONTH(date($A$1;MONTH(A2&1);1);0));1)
Remove the TRANSPOSE function invocation:
=ARRAY_CONSTRAIN(ArrayFormula(date($A$1;MONTH(A2&1);1)+transpose(COLUMN($C$1:$BK$1)-3));DAY(EOMONTH(date($A$1;MONTH(A2&1);1);0));1)
EDIT
(Following your commentHow to vertically list all days of the month in Google Sheets)
I gave it a try but I got a Parse error.
ALWAYS CHECK YOUR LOCALE (when using copy/paste)
In your case you ONLY have to change , to ;.
So the formulas will be
For Horizontal
=TRANSPOSE(SEQUENCE(DAY(EOMONTH(A1&A2;0));1;A1&A2;1))
For Vertical
=SEQUENCE(DAY(EOMONTH(A1&A2;0));1;A1&A2;1)
Use twice and format accordingly.
Original answer.
Instead of that long formula try this one.
For Horizontal
=TRANSPOSE(SEQUENCE(DAY(EOMONTH(A1&A2,0)),1,A1&A2,1))
For Vertical
=SEQUENCE(DAY(EOMONTH(A1&A2,0)),1,A1&A2,1)
Use twice and format accordingly.
That`s great but the dates I am getting are not in a chronological order since their "code" is something like 44324 and they are order by it.

Reading csv from the second line and creating output

I want from a csv archive to read only one column. The problem is that I want to read this column from the second line and by using these commands:
[d1,tex]= xlsread(filename1);
name=tex(:,4)
it's reading from the first line.
Also, I would like to create a matrix that will inclue two columns that have come from commants (equations etc) in my Matlab code.
xlsread is deprecated by MathWorks. Try using readtable in the future.
To your original question, I'm assuming that you want to read everything in the 4th column from the second row onward. If so, your second line is incorrect:
name = tex(2:end,4)
Without further example code, I can't answer the rest of your question. Add some details and I'll see what I can do.

read a formula stored in a text file in scalding

The problem is that i have 2 files :
1st file having 4 columns as in
1,Sanchit,60,80
2nd file having 2 columns as in
1,(1-(x/y))>1
now i want to apply the formula in 2nd file on values 60 and 80 which i will read from 1st file.
I have tried reading the formula column and wish to compute the formula using the mentioned values, but unable to do so.
Any kind of help will be appreciated. thanx
EDIT : There is a java api that helps. I have included that into my project and now works great
Evaluating a math expression given in string form
Head over to this link for the solutions
Strictly speaking, this is not exacly a Scalding question but you can use something like Apache Commons JeXL to execute formulas dynamically. So you would read the formula from the 2nd file, give it first file record object as a context and execute it.

Jasper reports: Overlapped fields not shown in excel output

Take the following example:
I have one very wide column (lets say 150pt), positioned on x=0
I have 2 columns of 25pt, positioned on x=100 and x=125. Thus, these are overlapping the first.
Depending on certain conditions (parameters to the report), I do or do not print the 2 overlapping columns. I do this by using the "print when expression ...".
This works like a charm when I use the PDF as output, but when I generate the report in excel, I do not get the big field, it is just missing. As long as I do not print the 2 overlapping fields, everything remains OK.
Any ideas on how to solve this one?
Thanks
Sounds like the answer is no ... hopefully there is a better answer
http://community.jaspersoft.com/questions/503288/missing-columns-excel
... the columns are overlapping. And the so-called "grid
exporters" like the HTML, XLS and CSV exporters do not support
overlappging elements. The elements that are behind do not print.
I hope this helps. Teodor

Excel/VBA - Copy and paste data into a worksheet in a specific row based on date

I have what I think is a pretty simple question.
I have a report that is updated daily. A specific range (B5:AC5) from one worksheet needs to be copied to a different worksheet on a daily basis. This doesn't need to be done automatically, I'd just like to add the code for it into a formatting macro I've created.
I have two issues with this:
I want the data to be pasted in the row that corresponds with that specific day. Column A in worksheet "Daily" has the list of working days for that month. So all I need is for the macro to find today's date in Column A in "Daily", and paste b5:AC5 from "Matrix" in b?:ac? in that row on "Daily".
I also need it to be a paste special, with only the values being pasted.
I'm very new to VB, but can usually follow code logic pretty well. Let me know if you need any more information from me. Thank you so much!
Assuming that your range will always be in B5:AC5, here is what I came up with:
Sub FindToday()
Dim FoundDate As Range
Set FoundDate = Worksheets("Daily").Columns("A").Find(DateValue(Now), LookIn:=xlValues, lookat:=xlWhole)
If Not FoundDate Is Nothing Then ' if we don't find the date, simply skip.
Worksheets("Matrix").Range("B5:AC5").Copy
FoundDate.Offset(0, 1).PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, False, False ' You can see that the first argument in PasteSpecial is set to only paste values.
End If
End Sub
I tested this as best I could given your information. I put a set of ascending numbers in the B5:AC5 range, with formulas, put a set of ascending dates for one month in the Daily sheet, and it seems to do what you're looking for.
Hope this helps.