I'm having trouble getting my RTF template to accept a nested choose in my first cell. I have:
<?choose?>
<?when: FIRST_COLOR='Red'?>
<?FIELD_VALUE?>
<?end when?>
<?otherwise?>
<?choose?>
<?when: SECOND_COLOR?>
<?xdofx:FIELD_VALUE_2||'Z'?>
<?end when?>
<?otherwise?>
<?FIELD_VALUE_2?>
<?end otherwise?>
<?end choose?>
<?end otherwise?>
<?end choose?>
I also tried without the colon in the when statements, but instead of an error, I only get two out of 50 records.
I found that a nested if worked instead.
<?xdofx:if FIRST_COLOR='Red' then
FIELD_VALUE
else
if SECOND_COLOR!='' then
FIELD_VALUE_2||'Z'
else
FIELD_VALUE_2
end if?>
If your original example was the code you were actually using, you were missing colons. It should be:
<?otherwise:?>
That would cause an issue, but I cannot say whether it would have caused your issue since you did not specify the exact error you were getting.
Related
I'm using IFS and REGEXMATCH to assign values to each cell. The desired outcome is to return 'Info' if a cell contains 'how' 'where' 'what' 'who' but at the same time does not contain 'buy' 'coupon' 'discount' and 'deals'. If the cell contains 'buy' 'coupon' 'discount' and 'deals', it should return 'Commercial'.
For example: cell containing 'where to go' should be Info,
cell containing 'how to buy' should be 'Commercial' because of the 'buy' keyword
My current formula looks like this:
=IFS(REGEXMATCH(J9,"**how|where|what|who**<>buy<>coupon<>discount<>deals"),"Info",REGEXMATCH(J9,"buy|coupon|discount|deals"),"Commercial")
The problem here is it is returning 'Info' for cells like 'how to buy' when it should return 'Commercial'. It only works for 'who', but not for 'how' 'where' and 'what'.
Any thoughts what could be wrong?
I'm still new to regex, would appreciate it if anyone could help me fix this!
You can use the following formula instead
=IF(AND(REGEXMATCH(J8,"how|where|what|who"),NOT(REGEXMATCH(J8,"buy|coupon|discount|deals"))),"Info","Commercial")
You cannot use <> in a regex. We use the NOT instead.
Functions used:
REGEXMATCH
IF
AND
NOT
I'm brand new to using PBI but as far as I can tell, I should be able to substitute a parameter as part of a Direct Query in place of a hard-coded variable...ie
let
Source = Sql.Database("NAMEOFDB", "CMUtility", [Query="sp_get_residentsinfo "& home_name]),.....
instead of
let
Source = Sql.Database("NAMEOFDB", "CMUtility", [Query="sp_get_residentsinfo 'NAME OF HOME'"]),...
However, the parameter-included version just says
DataSource.Error: Microsoft SQL: Incorrect syntax near 'House'.
Details:
DataSourceKind=SQL
DataSourcePath=NAMEOFDB;CMUtility
Message=Incorrect syntax near 'House'.
Number=102
Class=15
"House" is the currently - assigned last word of the home_name variable. What have I done wrong?
PS - I have surmised that I shouldn't need the extra & at the end of the parameter, as I'm not adding anything else to the query, but even with both &s it still doesn't work.
The type of your parameters is text. In SQL, text literals must be quoted, i.e. sp_get_residentsinfo 'NAME OF HOME', but the statement build by you is sp_get_residentsinfo NAME OF HOME.
You should use Text.Replace to escape single quotes in the parameter's value and append a quote before and after it.
I have a a feature column that has HTML tags in it. I would like to remove all tags.
An example of one row of data from column "body" is as follows:
"<p>Are questions related to and similar products on-topic?</p>"
I would like the output after using RegexTokenizer() to be as follows:
"are questions related to and similar products on-topic?"
Here is what I have started:
val regexTokenizer = new RegexTokenizer()
.setInputCol("body")
.setOutputCol("removedTags")
.setPattern("")
I think I need to fix the .setPattern() but unsure of how.
Assuming that you may not have any other < or > in your strings, maybe,
<[^>]+>
replaced with an empty string might be working OK to some extent, otherwise it'd fail.
If you wish to simplify/modify/explore the expression, it's been explained on the top right panel of regex101.com. If you'd like, you can also watch in this link, how it would match against some sample inputs.
I'm rendering texts in a prawn pdf report and would like to define the exact spacing after a paragraph.
I found :leading, which helps to define the line height, but nothing to define the spacing after a new paragraph (within the same cell or bounding box).
So far I have not found out how to define the spacing as such, but I still think I found the problem why the space was too large.
I add the statement
puts content.dump
to my class to print the content on the console.
In the cases where I had a paragraph in the content, the paragraph was replaced by \n\n.
Example:
<p>Text</p><p>Text</p>
is changed to
"Text\n\nText\n\n"
As I anyway use an html sanitizer method to remove undesired html tags, I could extend the method with the following:
res = content.gsub(/\n{2,2}/, "\n")
res = res.gsub(/\n{3,}/, "\n\n")
This solved the problem for me.
Please help. I'm trying to get the cell to return blank but I'm having trouble.
=IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,IF(AG2=""),"",0))
There's and error message when I include the last argument IF(AG2=""),"",0.
This alternative hasn't worked either =IF(ISBLANK(AG2),"",IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,0)))
I've also tried with using IFERROR to return blank rather than DIV/O which ruins my pivot table. Thanks so much
Perhaps:
=IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,IF(AG2="","",0)))
Your error was parenthetical.