TYPO3: Condition "if column empty"? - typo3

I'm looking for a condition to check wether a certain column is empty.
Something like this:
[colPos.0 = empty]
#do stuff
[global]
Thanks in advance.
Edit:
I think it's quite unclear what I'm looking for. So let me add some information:
I've got a column for a teaser image in the BE (colPos = 0). If it contains an element, it should regularly display this element. If not (== if empty), it should use another image instead.

There is of course a possibility to show stuff wether a Column has content or not,
but there is no TS-condition for this.
based on https://kuttler.eu/en/post/change-template-if-content-exists-in-typo3/,
here is my solution for this:
temp.foo {
temp.foo = COA
10 = COA
10 {
10 < styles.content.get
10.select.where = colPos=1
# conditional to test if content exists in column
if.isTrue.numRows {
# check current page page
pidInList = this
# in the table tt_content
table = tt_content
# colPos = 1
select.where = colPos=1
}
}
20 = COA
20 {
10 < lib.somethingElse
# conditional to test if content exists in column
if.isFalse.numRows {
# check current page page
pidInList = this
# in the table tt_content
table = tt_content
# colPos = 1
select.where = colPos=1
}
}
}
if.isTrue and if.isFalse are doing the trick here.
HTH

You can use if function, sample (from doc):
page.10 = COA_INT
page.10.10 = TEXT
page.10.10 {
stdWrap.if.isNull.field = description
value = No description available.
}
Edit: Also, if you are using Fluid template, you can just use f:if condition.

Related

Word VBA Text Box on first page not anchoring to table in document with a table and textbox each page

I have the following Word VBA code which creates a word document, puts a table on each page, and anchors a textbox to each table. On pages 2-6 the textboxes are correctly anchored and appear underneath the table. But on page 1 the table is not anchored correctly, and seems to be placed at 0, 0 on the page.
Simplified code that demonstrates the issue:
Dim myDoc
Set myDoc = Documents.Add
myDoc.Select
Dim i
For i = 1 To 6
Dim aRange
Set aRange = ActiveDocument.Paragraphs.Last.Range
Dim myTable
Set myTable = myDoc.Tables.Add(aRange, 10, 10)
myTable.Columns.Width = CentimetersToPoints(0.8)
myTable.Rows.Height = CentimetersToPoints(0.8)
Dim tb
Set tb = ActiveDocument.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=0, Top:=CentimetersToPoints(1.2), Width:=CentimetersToPoints(8), Height:=CentimetersToPoints(10), _
Anchor:=myTable.Cell(10, 1).Range.Characters.First)
Set aRange = ActiveDocument.Paragraphs.Last.Range
aRange.InsertBreak
Next i
Is there a way to get page 1 to display correctly, with the textbox appearing underneath the table?
For example:
Dim myDoc As Document, i As Long
Set myDoc = Documents.Add
With myDoc
For i = 1 To 6
.Tables.Add Range:=.Range.Characters.Last, NumRows:=10, NumColumns:=10
With .Tables(i)
.Columns.Width = CentimetersToPoints(0.8)
.Rows.Height = CentimetersToPoints(0.8)
End With
.Shapes.AddTextbox Orientation:=msoTextOrientationHorizontal, _
Left:=0, Top:=CentimetersToPoints(1.2), Width:=CentimetersToPoints(8), Height:=CentimetersToPoints(10), _
Anchor:=.Tables(i).Cell(10, 1).Range.Characters.First
If i < 6 Then .Range.Characters.Last.InsertAfter Chr(12)
Next i
End With

Bulk copy filtered rows from one google sheet to another google sheet

I have a spreadsheet where I am able to filter the sheet based on a value on a column. I can copy the filtered data using isRowHiddenByFilter. But this does it one row at a time. I am looking for some input on how I can copy say 200 rows that I obtain after using a filter to be copied to another spreadsheet all at once and not evaluating 200 rows.
This is what I have working:
var criteria = SpreadsheetApp.newFilterCriteria().whenTextContains("I do NOT
plan").build();
ss.getActiveSheet().getFilter().setColumnFilterCriteria(4,criteria);
var nrsheet = ss.getSheetByName("Not Returning");
for (var i = 2; i < sheet.getLastRow(); i++)
{
if(!sheet.isRowHiddenByFilter(i))
{
row_data = sheet.getRange(i, 1, 1, sheet.getLastColumn()).getValues();
one_arr_nr = row_data.join().split(",");
nrsheet.appendRow(one_arr_nr);
}
}
This is what I would like to do:
Remove the for loop to evaluate each row and be able to copy what I see on the spreadsheet to be copied to the Not Returning sheet. Any help on how I can proceed?

Send TYPO3 EXT:powermail mail to different receivers depending on selection in a dropdown

I often have the requirement to send a powermail-form to different receivers depending on a selection of a selectfield within the form.
Im using TYPO3 7.6.x and Powermail 3.3.0
How can this be done?
With the help of #alex-kellner in the slackchannel of EXT:powermail i found a quite easy solution for that:
Basically there are 2 Steps needed:
Step1
Values for the Options in the select field.
You need to add values to your option in the select field. This can be done by appending a pipe | to your option and simply add the value
MyRecieverEmail 1 | 1
MyRecieverEmail 2 | 2
MyRecieverEmail 3 | 3
In addition to that, you need to know the marker / variable / individual fieldname of your field. You can find that name in the extended tab of your field.
You can also give this field an "own" variable name if needed. The variable is wrapped with {} but you will not these in step 2
Step 2
Now you need to add some TS in your setupfield.
Background information: Basically this changes the reciever for a form:
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your#email.com
Now you need to check wich option was choosen in the form. This is done by a global condition:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
Where yourVariableFieldname ist the individual fieldname from the extended tab in the field and 1 is the value of the first option (MyRecieverEmail 1)
By using this TS, the form will be send to your#email.com if the first option MyRecieverEmail 1 is choosen in the form:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your#email.com
[global]
You can now add as much conditions as you need. The complete example would be:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourfirst#email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yoursecond#email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 3]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourthird#email.com
[global]
Please be aware that this will be in charge for every field with the fieldname {yourVariableFieldname} in your TYPO3-Install where this TS is taken into account.
This can be useful if you use this field exactly like this in multiple forms.
If you dont want this to be in charge you have 2 options to avoid this:
only place the TS on the Page where your form is located.
You can add this to your global condition:
&& [globalString = GP:tx_powermail_pi1|mail|form = 123]
Where 123 is the ID of your form.
This would then look like this:
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2] && [globalString = GP:tx_powermail_pi1|mail|form = 123]
Since 9.5 something like this:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 1 ]
should works
This worked for me:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 1 ]
plugin.tx_powermail.settings.setup {
receiver.overwrite {
email.value = MYEMAIL
email = TEXT
}
}
[END]
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/yourVariableFieldname') == 2 ]
plugin.tx_powermail.settings.setup {
receiver.overwrite {
email.value = MYEMAIL2
email = TEXT
}
}
[END]

AX 2012 Display totals in a form part on a list page

How can you display the total quantity of all selected records from a list page on a form part?
Your question is pretty open ended, but here is some sample code I wrote to loop over the selected records so you can "do" something with it. I just chose SalesLine as a sample table buffer that you might select.
int i;
Qty totalQty;
// Make this your data source
FormDataSource fds;
// This is an array of what records are marked
Array markedRecords = fds.recordsMarked();
// This is the table buffer that you can look at
// when looping over the selected records
SalesLine salesLine;
// This loops over the selected records so you can "do" something
i = 1;
while (i <= markedRecords.lastIndex())
{
salesLine = fds.cursor(markedRecords.value(i));
totalQty += salesLine.SalesQty;
i++;
}

How to automatically generate sequent numbers when using a form

Ahab stated in 2010: the complex looking number based on the Timestamp has one important property, the number can not change when rows are deleted or inserted.
As long as the submitted data is not changed by inserting deleting rows the simple formula =ArrayFormula(ROW(A2:A) - 1) may be the easiest one to use.
For other situations there is no nice reliable solution. :(
Now we live in 2015. Maybe times have changed?
I need a reliable way to number entries using a form.
Maybe a script can do the trick? A script that can add 1 to each entry?
That certain entry has to keep that number even when rows are deleted or inserted.
I created this simple spreadsheet in which I added 1,2, and 3 manually,please have a look:
https://docs.google.com/spreadsheets/d/1H9EXns8-7m9oLbCrTyIZhLKXk6TGxzWlO9pOvQSODYs/edit?usp=sharing
The script has to find the maximum of the former entries, which is 3, and then add 1 automatically.
Who can help me with this?
Grtz, Bij
Maybe a script can do the trick? A script that can add 1 to each
entry?
Yes, that would be what you need to resort to. I took the liberty of entering this in your example ss:
function onEdit(e) {
var watchColumns = [1, 2]; //when text is entered in any of these columns, auto-numbering will be triggered
var autoColumn = 3;
var headerRows = 1;
var watchSheet = "Form";
var range = e.range;
var sheet = range.getSheet();
if (e.value !== undefined && sheet.getName() == watchSheet) {
if (watchColumns.indexOf(range.getColumn()) > -1) {
var row = range.getRow();
if (row > headerRows) {
var autoCell = sheet.getRange(row, autoColumn);
if (!autoCell.getValue()) {
var data = sheet.getDataRange().getValues();
var temp = 1;
for (var i = headerRows, length = data.length; i < length; i++)
if (data[i][autoColumn - 1] > temp)
temp = data[i][autoColumn - 1];
autoCell.setValue(temp + 1);
}
}
}
}
}
For me the best way is to create a query in a second sheet pulling everything from form responses in to second column and so on. then use the first column for numbering.
In your second sheet B1 you would use:
=QUERY(Form!1:1004)
In your second sheet A2 you would use:
=ARRAYFORMULA(if(B2:B="",,Row(B2:B)-1))
I made a second sheet in your example spreadsheet, have a look at it.