By: pela222
Date: 2016-08-03
Time: 21:27
|
Delete column of table if var = xHi Skrol29
I am struggling with having this simple think done. I want to have colum no 2 deleted when variable TerLifIns2.coverBasis = Single and have no cue how to achieve this. Removing row no 2 works perfect when TerLifIns2.lifeCoverMark = 0. Please see my ms word template below: ------------------------------------------------------------------------------------------------------------------ |[TerLifIns2.coverBasis;ope=mko:Single,delcol;colnum=2] | | ------------------------------------------------------------------------------------------------------------------ |[TerLifIns2.lifeCoverMark;ope=mko:0;magnet=tbs:row] | | ------------------------------------------------------------------------------------------------------------------ Should I use if then, when ??? Please help me. Wasted over 2 hours and cant find solution. Tried e.g. [onshow;ope=delcol;colnum=3;if [TerLifIns2.coverBasis]=’Single’] [onshow;ope=delcol;colnum=3;when [TerLifIns2.coverBasis]=’Single’] I know that when wont work as no block was defined. But I am just showing you my attempts. |
|||
By: pela222
Date: 2016-08-07
Time: 11:41
|
Re: Delete column of table if var = xHi Skrol29,
appreciate some clue on conditional statement for: [onload;ope=delcol;colnum=2] Thank you. |
|||
By: Skrol29
Date: 2016-08-17
Time: 23:31
|
Re: Delete column of table if var = xHi,
Unfortunately you cannot use parameter "ope=mko" or parameter "if' when using "ope=delcol". This is because "ope=delcol" is processed at the very first of other parameters. (see http://www.tinybutstrong.com/manual.php#html_field_prm_order ) and then the TBS field is deleted (this is mentioned more clearly in the new version of the doc). Thus you can use the value of the field ([val]) or a global variable ([var]) but only as the direct numbers of columns to delete. Like : [TerLifIns2.col_to_delete;delcol;colnum=[val]] The good news is that if "colnum=0" then no column is deleted. You can use this in your case in order to avoid the delete :
Please note that "colnum=0" will work properly only since last OpenTBS version 1.9.7 because of a bug. |
|||
By: pela222
Date: 2016-09-19
Time: 11:56
|
Re: Delete column of table if var = xHi Scrol29
I was on holidays and only now found some time to check your solution. What I did now as your advice I created based on my [TerLifIns2.coverBasis] an integer variable [TerLifIns2.coverBasisMark] == 0 or 3 depending on what I want to achieve. Variable is merged properly in my doc template and is showing as 0 or 3 when placed in docx
|[TerLifIns2.coverBasisMark.col_to_delete;delcol;colnum=[val]] | | [TerLifIns2.coverBasisMark] | | ------------------------------------------------------------------------------------------------------------------------------------- but column 3 is not being deleted. did this on dummy table without any merged cells or other changes in table format. Result is still table with 4 columns like below: ----------------------------------------------- | | | 3 | | ----------------------------------------------- PS should it be ope=delcol or just delcol in my code? anyway neither is working. Column is not deleted. Thanks again for your time and help. pela222 PS2 is this tbs_plugin_delcol.php as described here: http://www.tinybutstrong.com/forum.php?thr=2879 already implemented in my tbs_plugin_opentbs.php ?? or do I need to add this plugin?? PS3 Can you please check if the link 'Download last version 1.9.7' on http://www.tinybutstrong.com/opentbs.php is leading to the newest version? the file says: * @version 1.9.6 * @date 2016-03-24 Thx. |
|||
By: pela222
Date: 2016-09-19
Time: 17:09
|
Re: Delete column of table if var = xHi, me again,
Two things: Deleting column no.3 works when I use this:
The problem is that it works as long as I have it for only one table. When code putted in all 6 tables and more than one PerAcc2 is in array (e.g one Bronze plan and one Silver checked) it falls in some sort of loop I think and after about 1 min I am getting an error message on my server side. The whole starcture of my docx is as follows: Table no1: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier Plus][PerAcc2.coverBasisMark.col_to_delete;delcol;colnum=[PerAcc2.coverBasisMark]] | | TABLE FOR BRONZE PREMIER PLUS| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Table no2: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier][PerAcc2.coverBasisMark.col_to_delete;delcol;colnum=[PerAcc2.coverBasisMark]] | | TABLE FOR BRONZE PREMIER | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Table no3: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Silver Premier Plus][PerAcc2.coverBasisMark.col_to_delete;delcol;colnum=[PerAcc2.coverBasisMark]] | | TABLE FOR SILVER PREMIER PLUS | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ... Table no6: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Gold Premier][PerAcc2.coverBasisMark.col_to_delete;delcol;colnum=[PerAcc2.coverBasisMark]] | | TABLE FOR GOLD PREMIER | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|||
By: pela222
Date: 2016-09-30
Time: 17:11
|
Re: Delete column of table if var = xHi,
appreciate some clue on query. Thank you. |
|||
By: Skrol29
Date: 2016-10-04
Time: 13:00
|
Re: Delete column of table if var = xHi,
> Can you please check if the link 'Download last version 1.9.7' Thank you for this point. There is actually a mistake in the zip file. I will fix this very soon. This probably explain why "colnum=[val]" is not working. |
|||
By: Skrol29
Date: 2016-10-04
Time: 22:00
|
Re: Delete column of table if var = x> Can you please check if the link 'Download last version 1.9.7'
This is fixed. Can you try and see if your problem disappear with the convenient OpenTBS 1.9.7 ? |
|||
By: pela222
Date: 2016-10-04
Time: 22:17
|
Re: Delete column of table if var = xHi Skrol29
I saw your post later afternoon today but was up too my eyes. I will check hopefully tomorrow and will know immediately. Thank you for time. |
|||
By: pela222
Date: 2016-10-05
Time: 13:26
|
Re: Delete column of table if var = xHi Skrol29
I just downloaded ver 1.9.7. File is fine this time. * @version 1.9.7 * @date 2016-08-16 Unfortunately this has not solved my problem with deleting columns. When using phrase:
As stated before, what is working for me is:
|
|||
By: Skrol29
Date: 2016-10-05
Time: 14:58
|
Re: Delete column of table if var = xIf [PerAcc2.coverBasisMark.col_to_delete] is supposed to point to a single value, then
[PerAcc2.coverBasisMark] is supposed to point to an array. So I'm missing something. |
|||
By: pela222
Date: 2016-10-05
Time: 19:56
|
Re: Delete column of table if var = xHi Skrol29
please have a look at my post from dated: 2016-09-19. [PerAcc2.coverBasisMark] is not an array. It is returning value 0 or 3. So far I thought that "col_to_delete" is a phrase which is part of syntax. I understand it is not. So now removed this from my code. I have just tried this:
It is working fine in dummy table. But when placed in the proper tables I am using to generate document I am getting error when trying to open docx generated. Error message is: "The name in the end tag of the element must match the element type in the start tag" I think the reason for error is that I am using two syntax codes in the same table. Please see my post Date: 2016-09-19 Time: 17:09 The whole starcture of my docx is as follows: Table no1: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier Plus][PerAcc2.coverBasisMark;delcol;colnum=[val]] | | TABLE FOR BRONZE PREMIER PLUS | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Table no2: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier][PerAcc2.coverBasisMark;delcol;colnum=[val]] | | TABLE FOR BRONZE PREMIER | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Table no3: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Silver Premier Plus][PerAcc2.coverBasisMark;delcol;colnum=[val]] | | TABLE FOR SILVER PREMIER PLUS | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ... Table no6: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Gold Premier][PerAcc2.coverBasisMark;delcol;colnum=[val]] | | TABLE FOR GOLD PREMIER | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This code
Second code
PS. All working great when using [PerAcc2.coverBasisMark;delcol;colnum=[PerAcc2.coverBasisMark] in my 6 complex tables: e.g Table no1: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |[PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier Plus][PerAcc2.coverBasisMark;delcol;colnum=[PerAcc2.coverBasisMark]] | | TABLE FOR BRONZE PREMIER PLUS | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|||
By: Skrol29
Date: 2016-10-06
Time: 09:31
|
Re: Delete column of table if var = xHi,
Can you give to me the content of the data merged with 'PerAcc2' ? So I could try to reproduce your problem. Can you also try by changing the places of the two TBS fields. That is change: [PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier Plus][PerAcc2.coverBasisMark;delcol;colnum=[val] with: [PerAcc2.coverBasisMark;delcol;colnum=[val][PerAcc2.planLevel;magnet=w:tbl;ope=mok:Bronze Premier Plus] If you had no TBS error when adding the expression with "col_to_delete", that probably means you turned error message off with $TBS->SetOption('noerr', true). If it's so, it's bettor to set messages on when debugging. |
|||
By: pela222
Date: 2016-10-06
Time: 10:23
|
Re: Delete column of table if var = xHi Skrol29,
changing places as sugested helped and all working now with structure:
Regarding setting $TBS->SetOption('noerr', false) I am having some troubles as my own system will return error :( I need to speek with the chap who made this system for me and how to have this tbs messages displayed. content of my 'PerAcc' will look like this:
|