Output additional Text in Powermail if specific Checkbox is checked - typo3

so here's my problem: I tried to output an additional text once a specific checkbox is checked in powermail.
The select field contains multiple options and all are selectable of course, but when i.e. field 1 is checked the sender should have the standard text in the mail plus "Lorem ipsum", but when the field isn't checked there should be no additional output at all.
I could find a solution for altering texts depending on a selection for single selects / dropdowns and it works like a charm, but for a reason the multi-select doesn't work at all. I can't figure out why so maybe someone can help.
TS:
lib.serverex = CASE
lib.serverex {
key.data = GP:tx_powermail_pi1|field|produktang|1
key.intval = 1
1 = TEXT
1.value = Lorem Ipsum
#Default
default = TEXT
default.value =
}
The email in powermail looks like this:
Some standard text...
{f:cObject(typoscriptObjectPath:'lib.serverex', data:'{produktang}')}
The checkbox configuration inside the form (id: produktang):
first product | 1
second product | 2
third product | 3
fourth product | 4
fifth product | 5
Either it appends it no matter what the input is/checked boxes are or it doesn't send the additional text at all. I'm probably missing something here.
Thanks in advance!

The result of field {produktang} is an array (of course because it's a checkbox). So you have to find out if there is any key with value "2" (e.g. if you're searching for product 2) of in your case tx_powermail_pi1|field|produktang|1 == 2

I solved it now with kind of a trick because I couldn't make it work in a different way.
What I did:
I moved the specific product where the email alters to the first position in the multiselect element. So it's Index will be 0.
The next thing is to check if the element in position 0 of the array equals the desired product, in my case it's "firstProduct". Since it's in the first position it'll always be "firstProduct" if "firstProduct" is checked and the additional text will be "printed". I set the default text to an empty string so it'll stay blank in every other case.
Here's the code:
lib.serverex = CASE
lib.serverex {
key.data = GP:tx_powermail_pi1|field|produkt|0
firstProduct = TEXT
firstProduct.value = Lorem Ipsum
#Default
default = TEXT
default.value =
}
The configuration of the Checkbox inside powermail:
firstProduct
secondProduct
thirdProduct
fourthProduct
fifthProduct
And the code which is inside of the email itself:
{f:cObject(typoscriptObjectPath:'lib.serverex', data:'{produkt}')}
It probably works in another way as well, but I couldn't solve it another way. Hope this helps if someone encounters the same issues I had.

Related

Suppress a Text Object Based on Field Value in Object

I have a Text Object that contains a text string followed by a database field Max Weight {table.field}
I want to suppress all of the Text Object whenever {table.field} = 0.
I tried the following formula under Format Text > Common > Suppress
if {table.field} = 0 then true else false
What I get is the field value within the text object either on or off while the text is always suppressed. What do I need to do to make this work? Thanks.
You can try 2 different solutions:
1) Keeping your Max Weight label, create a new Formula in the 'Formula Fields' then enter this code:
if {table.field} = 0 then '' else ToText({table.field})
2) Supressing all text, you have to create a new Formula too, but type this:
if {table.field} = 0 then '' else 'Max Weight ' + ToText({table.field})
This second way, you will create a label that will only appears when your conditions happens, and you must replace the old TextObject with this new Formula. This will cause a blank area, because no text and no weight will show, but it looks like exactly what you need.
I just tested here and it's working. Note that both 'spaces' are in the document. Attached is an image that may help you find the formulas section. Hope you can use it.

Access VBA to Change an Image in a Continuous Form

I am trying to create a receipt form where people will confirm if they've received the full quantity of an order. As part of this, I want the following to happen:
If they received the full quantity, a green check mark appears
If they received a partial quantity, an orange triangle appears
If they received no items, a red x appears
To accomplish this, I'm using a continuous form with 3 image files for each situation. I'm using the code below to change the image when the quantity is changed. The problem is, when the quantity is change on 1 line, the symbol changes for all lines. I'll post pictures as well.
Any thoughts on how I can fix this?
I'm open to other methods of accomplishing this idea too.
Private Sub FinalQTY_AfterUpdate()
If IsNull(Me.FinalQty) Then
MsgBox "You must enter a quantity for this item"
Me.FinalQty.SetFocus
Exit Sub
Else
LValue = Me.[FinalQty]
If IsNumeric(LValue) = 0 Then
Me.FinalQty = ""
MsgBox "Qty must be a numeric value"
Me.QTY.SetFocus
Exit Sub
End If
End If
Me.FinalTotalPrice = Me.FinalPrice * Me.FinalQty
If Me.FinalQty = 0 Then
Me.Yes.Visible = False
Me.Change.Visible = False
Me.No.Visible = True
End If
If Me.FinalQty < Me.QTY Then
Me.Yes.Visible = False
Me.Change.Visible = True
Me.No.Visible = False
End If
If Me.FinalQty = Me.QTY Then
Me.Yes.Visible = True
Me.Change.Visible = False
Me.No.Visible = False
End If
End Sub
This is before I adjust the quantity:
This is after I adjust the qty of only the second line:
Since the formatting of each record displayed by a continuous form is inherited from the form design template, any changes to the template will be automatically applied to all records displayed by the form, aside from Conditional Formatting rules in effect or the handful of properties which may changed via the OnPaint event of the Detail section.
One possible alternative might be to add a new field to your table with a data type of OLE Object and populate the value on the AfterUpdate event using the AppendChunk method, sourcing image data from a separate table containing three records corresponding to your green tick, orange triangle, and red cross images.

How to change background color for each two rows in SSRS in a group

How can I write the expression in order to change background color for each two rows in SSRS?
I need something like that:
I tried expression
=IIF(Fields!Type.Value="2016 Submitted" , "LightBlue",
IIF(Fields!Type.Value="2015 Submitted" , "LightBlue",
Nothing))
But because some months dont have values it looks like this:
If I try this expression I get below:
=IIF(RunningValue(Fields!Count.Value, CountDistinct, Nothing) MOD 2 = 1, "White", "PaleTurquoise")
Dance-Henry I tried your code
=IIF(RowNumber(Nothing) Mod 4 = 1 or RowNumber(Nothing) Mod 4 = 2, "Aqua","White")
and this is what i got:
You can select the row in design pane and press F4 to setup property BackgroundColor as =IIF(RowNumber(Nothing) Mod 4 = 1 or RowNumber(Nothing) Mod 4 = 2, "Aqua","White")
Captures are attached. Do it accordingly.
RESULT is something like this
After going thru the link https://blogs.msdn.microsoft.com/chrishays/2004/08/30/green-bar-matrix/
Tested and it works well for the Green Bar Effect for Matrix. I will show it step by step here as for later reference.
Step 1: Create the Matrix and add one more column under the innermost row grouping in your matrix. (ColorNameTextbox here)
Step 2: Select the textbox of ColorNameTextbox and press F4 to setup BackgroundColor property as =Value shown below.
Step 3: Select the textbox of Matrix cell and press F4 to setup BackgroundColor property as =ReportItems!ColorNameTextbox.Value shown below.
Step 4: Drag the inner grouping header (ColorNameTextbox) to be as narrow as possible.
Step 5: Preview Pane to check the result.
If you could add a hidden color_group column and populate it with a new number at each point you want to change the color (in your case 1,1,2,2,3,3,4,4) then you could use something like the following (which works for varying size groups):
IIF(RunningValue(Fields!color_group.Value, CountDistinct, Nothing) MOD 2 = 1, "White", "PaleTurquoise")
I had a similar problem where I could not come up with alternating rows because my data has Column Groups that were the RowNumber(Nothing) method to fail. Learning from all the other posts here this is how I resolved it in steps.
I added the following code into the report properties, that provides a function to get the row number, each time it is called. The function increments the row count each time it is called. >>Right click space around the report >> Properties >> Code. Alternatively go to Code Properties Window, when the report is selected.
Add the following lines:
Public Row_Sum As Decimal = 0
Public Function Lookup_Sum( ) As integer
Row_Sum = Row_Sum + 1
Return Row_Sum
End Function
I added a new column at the beginning of the rows called No. that would calculate and show the row number.Right click the first column >>Insert Column>>Inside Group-Left.
On the expression for the new report add this line of code. Also take a note of the name of the TextBox that will have the No. Value. It will be needed in the next step. In my case the TextBox is called TextBox6 (Properties Window). >>Right Click Cell>>Expression.
Add the code:
=Code.Lookup_Sum()
I highlighted the entire row and went to the Background property and added the following expression to compute the row number.
Add the code(TextBox6 is the name Textbox name noted above):
=IIF(VAL(ReportItems!Textbox6.Value) MOD 2, "LIGHTBLUE", "WHITE")

Wrapping Content Elements via Fluid

I am experimenting with TYPO3 and Fluid and at the moment I am in trouble. It is about a backendlayout I created in TYPO3.
It consists of two content areas: "left-column" and
"right-column".
To bring them to frontend appearance via fluid was no problem. But then I created four content elements (text and image ) within "left column". I wanted to wrap each of these content elements with a bootstrap wrapper e.g. text "col-md-8" and img "col-md-4".
Unfortunately, I have not found any hints or documentation how to do this. Maybe someone can help me with that issue and tell me how to customize the wrappers of my content elements. Is it possible to do it via Fluid at all?
Backend layouts are used to map columns to your template, but they doesn't allow you to decide how each of them will be displayed. There are several solutions... but last time my favorite is extension Grid Elements.
It allows you to create sub-containers for Content Elements, so you can add, any combination of Bootstrap's grid layout (i.e. 2 columns - 4-8 or 3 columns - 3-3-3 etc...) and then wrap it whit Bootstrap classes.
Sample for mentioned 2 columns - 4-8 Grid Element record:
Title: 2 columns: 4-8 or whatever you want ;)
Alias: 2_columns_4_8 (must be unique)
Grid Configuration:
backend_layout {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Left
colPos = 221
}
2 {
name = Right
colPos = 222
}
}
}
}
}
Finally in your TypoScript template add rendering definition like this:
tt_content.gridelements_pi1.20.10.setup {
2_columns_4_8 < .default
2_columns_4_8 {
wrap = <div class="row">|</div>
columns {
221 < .default
221.wrap = <div class="col-sm-4">|</div>
222 < .default
222.wrap = <div class="col-sm-8">|</div>
}
}
}
(in the sample observe where and how alias and also colPos values are used later in TypoScript)
hint: Don't waste time for creating any possible combination of columns at beginning, instead create one ad hoc when required, usually you need only few of them.
P.S. TYPO3 is written uppercase, always!

Setting up some properties for a combobox (scroll, edit, jump)

There are 3 properties that I want to set for some VBA form comboboxes and I don't know if it's possible.
I don't want to let the combobox editable. Right now if the user types something in it that it submits the form it will send that value... I want to let him choose only from the values I added in the Combobox.
I want to make the list of items in the combobox scroll-able. Right now I'm able to scroll through the list if I use the scroll-bar but I don't know why I can't scroll with the mouse scroll.
And I want to jump to some item if I start typing. Let's say I have the months of the year in one combobox... if I start to type mar I want it to jump to march. I know that for the html forms this properties is by default but I don't know about VBA forms...
Thanks a lot
Of the behaviours you want, some are possible with settings on the Combo, others you will need to code
List of Months: Put a list of entries on a (hidden) sheet and name the range. Set .RowSource to that range
Match as you type: Set properties .MatchEntry = fmMatchEntryComplete and .MatchRequired = True
Reject non list entries: A Combo with these settings will allow you to type an invalid entry, but will reject it with an error message popup when you commit. If you want to silently reject invalid data as you type, you will need to code it.
If you want the selected value returned to a sheet, set .ControlSource to a cell address (preferable a named range)
By "...scroll with the mouse scroll..." I assume you mean the mouse wheel. Unfortunatley Forms don't support mouse wheel scroll. You will have to code it yourself. There is a Microsoft patch for this at here (not tried it myself yet)
Sample code to silently reject invalid entries
Private Sub cmbMonth_Change()
Static idx As Long
Dim Match As Boolean
Dim i As Long
If cmbMonth.Value = "" Then Exit Sub
If idx = 0 Then idx = 1
i = idx
Match = False
For i = 0 To cmbMonth.ListCount
If cmbMonth.List((i + idx - 1) Mod cmbMonth.ListCount) Like cmbMonth.Value & "*" Then
cmbMonth.ListIndex = (i + idx - 1) Mod cmbMonth.ListCount
Match = True
Exit For
End If
Next
If Not Match Then
cmbMonth.Value = Left(cmbMonth.Value, Len(cmbMonth.Value) - 1)
End If
End Sub
Set the propertie MatchEntry of combobox to 1 (fmMatchEntryComplete) and MatchRequired to true for example
combobox1.MatchEntry=1
combobox1.MatchRequired=True
[]'s