Show Straight Vertical Line based on Document Property drop-down selection - spotfire

The issue i am facing is easy to understand but harder to solution (at least for me). I have not found much googling this.
Probem: I would like to include a straight line to represent a fixed value of 28 on a line chart only when document property has "x" selected, otherwise, if document property "y" is selected, the line should move from 28 to 10, if document property has value "z" selected, then straight line should disappear (NULL).
By the way, this is the same document property (dropdown selection that is called ${firstStartORAssignedTime}.
Thank you in advance and apologies for having no code !

In the line charts Properties > Line & Curves > add a Horizonal Line as a custom expression and use the following :
case when "${firstStartORAssignedTime}"='x' then 28
when "${firstStartORAssignedTime}"='y' then 10
else null end
${DocumentPropertyName}
Will return the TEXT value off the document property so wrapping it in " " for the expression is needed.
DocumentProperty("DocumentPropertyName")
Will Return the Value of the document property (ie: a string , integer ect )
So you can also use :
case when DocumentProperty("firstStartORAssignedTime")='x' then 28
when DocumentProperty("firstStartORAssignedTime")='y' then 10
else null end

Related

Reference item in group ( Textbox )

I was using below line of code to edit word document's textbox. It is working pretty well.
wdDoc.Shapes("T1").TextFrame.TextRange.Text = sh.Range("Q2"). Value
But now I made some changes in my Word document (template file).
I Grouped few items with Shapes("T1").So now Shapes("T1") is inside Group(3).
Now code give error, because it can't find Shapes("T1").
How can I reference Shapes("T1") within Group (3)?
Thank you.
Only property I have found is Shape.GroupItems
Here is the solution:
With wdDoc.Shapes("Group 3")
For x = 1 To .GroupItems.Count
If .GroupItems(x).Name = "T1" Then
With .GroupItems(x)
.TextFrame.TextRange.Text = sh.Range("Q2").Value
End With
End If
Next
End With

VBA can not identify Excel's cell content correctly (line break issue)

The cell's content has a line break in between two lines. Usually if I use
If rngCellContent = "Line1" & Chr(10) & "Line2" then varReturn = True
it returns True but I have one case where it returns False. I pasted the "faulty content" into Notepad++ but I can see no difference. It also shows me the same line break (CRLF). Might there be a difference which gets "removed" through using the clip board?
How do I find out what kind of line breaks or non-print characters the cell contains that causes the return value to be false?
Note: I didn't compare the binary values of the strings yet. Can I just use a converter and paste it into there? Or will I run into the same problem?

I have text in separate lines inside same box, How to make it all in one line

Some of my text are in different lines inside same cell. I want them in single line. How do I bring them in single line ?
Example:
first cell contains:
Hi Ram, I want to go to movie today.
Are you willing to join?
If yes, let me know early.
Example:
Expected output:
Hi Ram, I want to go to movie today.Are you willing to join?If yes, let me know early.
New line in a cell A1 caused by alt+Enter for example, may be removed using a formula such as:
=SUBSTITUTE(A1,CHAR(10)," ")
Where A1 is the cell containing the text to be changed. You can enter the formula above in a different cell of course.
The parameter " " indicates 1 space to replace the line break. You could use any other character.
Another type of line break is CHAR(13). You can remove CHAR(13) using the same function again:
=SUBSTITUTE(SUBSTITUTE(A1, CHAR(13)," "), CHAR(10), " ")
In case you had some spaces already before the new-line character, you need to wrap the above formula in a TRIM function like so:
=TRIM(SUBSTITUTE(A1,CHAR(10)," "))
OR
=TRIM(SUBSTITUTE(SUBSTITUTE(A1,CHAR(13)," "),CHAR(10)," "))
Always make a copy of your file before you apply formulas that could change the data.
Note-1:
char(13) is officially called "carriage return" and char(10) is called "line feed".
CHAR(10) returns a line break on Windows, and CHAR(13) returns a line break on the Mac. This answer is for Windows. You can't visually see it but you can see its effect.
Note-2:
As #kojow7 answered, a text wrap can cause the text to appear on more than 1 line depending on the cell width and the text length. This answer does not resolve this case.
Related discussion can be found here: Remove line breaks from cell.
Two things you may need to fix here: 1) Line breaks and 2) Text Wrapping
To fix line breaks:
Select the cells that need to be changed
Press CTRL+H to open Search and Replace
In the Find box type CTRL+J to insert the line break character (it may look like nothing was inserted in the field, but it does insert a line break)
Decide whether to replace the line breaks with a space or with nothing
Press Replace All
To turn off text wrapping:
Select the cells that need to be changed
Go to the Home Tab
In the Alignment Group check to see if the Wrap Text button is clicked.
If it is, click on it again to deselect it.
Depending on your situation, you may need to fix either one or both of these.
Depending on your document it might contain linefeeds or carriage returns or BOTH.
Alexander Frolov (https://www.ablebits.com/office-addins-blog/2013/12/03/remove-carriage-returns-excel/) has written a very good blog post about different technics of finding and removing linebreaks in an Excel file. We will use the “macro way” of doing that – as it is the one that works either on Windows AND Mac. The search replace method offered here too will not work on Mac but on windows.
Add the below Macro to your document (slighlty modified from the original)
Change the value of “ReplaceWith” from ” ” (space) to anything you like a linebreak to be replaced with.
E.g. ReplaceWith = “-” will result in “Line1-Line2-Line3”
Run the Macro (Extras > Macro) while all cells are selected.
Sub RemoveCarriageReturns()
ReplaceWith = " "
LinefeedChar = Chr(10)
Dim recordRange As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each recordRange In ActiveSheet.UsedRange
If 0 < InStr(recordRange, LinefeedChar) Then
recordRange = Replace(recordRange, LinefeedChar, ReplaceWith)
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
If your separate lines are not gone by now please change "LinefeedChar" from "Chr(10)" to "Chr(13)" and run it again

How to clear a Text Input in Powerapp?

In Powerapp app, I have screen,which contain
1 : "text input", to enter CityName
2 : When I click on Clear button, How can I clear value of text input ?
Click here for more details of problem statement
Solution
step 1 : let text input name is "txtCity" and set it's Default property to ""
step 2 : set OnSelect event of button to Reset(txtCity)
solution shown in image
That would be one way of resetting, there are other ways to solve it too. By assigning a variable to TextInput's default property and setting that variable to "" or any other default value you want based on the scenario. How and when to use reset can be found here: https://learn.microsoft.com/sl-si/powerapps/functions/function-reset

How to delete a row in datagrid

How to delete a row in datagrid. I am using the following code and it's not working(first two lines are working and the 3'rd line is not working) how i change my code.
put the dgHilitedLines of group "DGP" into theLine
answer theLine
DeleteLine theLine
Delete line in DataGrid with Dispatch command is needed in case you do this outside the datagrid. E.g. with a button outside the datagrid.
on mouseUp
put the dgHilitedLines of group "DGP" into theLine
answer "The selected line var is : " & theLine
dispatch "deleteline" to group "DGP" with theLine
put the result into tDeleteresult
if tDeleteresult is not empty
then
answer "There has been a problem deleting the line with message: "&tDeleteresult
else
answer "Line Deleted"
end if
end mouseUp
Did you try using the index instead of the line?
put the dgHilitedIndex of me into theIndex
DeleteIndex theIndex
The line is always the current display order, say
A = 1
B = 2
C = 3
Thus if you delete line 2, the next line C will become line 2. This is usually a bit of a problem.
After delete line:
A = 1
C = 2
The index on the other hand is assigned when you fill the datagrid and stays the same for one row, no matter how you sort it. This way you can always identify that row
With index:
A = 1
B = 2
C = 3
After delete row 2:
A = 1
C = 3
I always, as a matter of practice, do this sort of thing in the clear. The tools and analytics within LC proper are far more accessible and powerful than within the DG itself.
So in general:
get the dgData of group "yourDG"
delete line whatever of it
set the dgData of group "yourDG" to it
Craig Newman
Same answer as MrCoolLion in a more concise way:
put the dgHilitedLines of group "DataGrid" into theLineNo
dispatch "deleteline" to group "DataGrid" with theLineNo

Resources