Orbeon forms - customize section repetitions by expression - orbeon

I have a text filed X. If X field is empty I want to set section Y repetitions to 1. If X field is not empty I want to set section Y repetitions from 0 to 1.
I tried to customize it in section repetitions like this:
Link to form: https://demo.orbeon.com/demo/fr/orbeon/builder/edit/485d30b47d4f7a5f7dde7674b4d53eeb5a390436
Expected behaviour:
if field X is not empty, section Y is optional (0 or 1 repetition); user can remove section
if field X is empty, section Y is required (1 repetition); user can't remove section
if section Y has 0 repetition and we remove value from field X then create one section Y repetition
Is it possible to do that in Orbeon?

Currently, the min/max setting for repeated content for repeated grids or repeated sections impacts the user's ability to add/remove rows/sections, but not the validity of the form should the number of rows/sections be below the minimum or above the maximum. This is covered by RFE #4567.
While what you suggest might be possible in the future, I think it is better, for usability, to handle this in a more explicit way:
Have a checkbox (e.g. "Provide additional information"), which is only shown if the text field isn't empty.
Create a non-repeated section, and set it to be visible if the field is empty or the checkbox is checked.

Related

Highlight entries in a row that do not match (with multiple instances)

I am trying to create a highlight in my sheet that will allow me on a row by row basis to highlight the version numbers that do not match the master column. I also want the rule to ignore anything that is marked as N/A as it should not be considered.
e.g. column E houses the latest version v1.0.2, columns H-O list the versions available at various locations, two of them are still on v1.0.0. I want any that do not match the master version (outdated) to highlight.
How can I do this and have it apply to each row individually? So row 7 values are highlighted based on E7 but row 8 values are highlighted based on E8. These are not plain numerical values but include text.
So I have figured it out after a bit of messing around based on answers to similar questions. All using Conditional Formatting.
Make sure that each rule created has the correct range applied so only that section of the sheet is checked (in my case H6:O18).
This ensures that whatever rule I add, it only applies to that part of my sheet.
Custom formula "=$H6:$O6<>$E6"
To explain this, it looks at the range of data entries (From the H to O columns - starting with row 6) and compares it to (in my case) the master entry in column E to compare. Basically asking do the entries differ?
The $ symbols are included in front of the column values to mark them as unchanging. The row numbers do not have the $ symbol and so can change. Therefore it checks H6:O6 against E6, but will check H12:O12 against E12. Maintaining the column but not the row.
Additional rule added "Cell is empty"
This is set to not highlight - applied to the same range (H6:O18). This is placed above the previous rule to overrule it. Therefore any blank cells are not highlighted as different, they are ignored.
Additional rule: "Text is Exactly"
This is applied to the same range and ordered above the original rule to again overrule it. The text to check is "N/A". Again this is set to not highlight or alter anything. This ensures that entries marked N/A are ignored much like blank cells.
An extra addition I included was duplicating the first formula but changing the <> to = and changing the highlight to green. This highlights anything that matches while any differences are highlighted red. N/A or blank cells are ignored.
Example of highlighted cells + Formula

How to duplicate (not extend) conditional formatting rule?

I have a conditional formatting rule (color scale) applied to a row (e.g. A1:Z1). I want the to duplicate this rule for another row, but when I use Paste Special -> Paste Conditional Formatting Only (or Paint Format tool), it simply makes the color scale rule to apply to the sum of ranges (e.g. A1:Z2). The problem is that it won't process ranges separately, it will just join them into a single range and find the biggest / smallest number over the joint range, rather than in individual ranges.
The same applies if the range is defined in format "A1:Z1,A2:Z2".
What I want is just to avoid defining the same color scale rule for different rows manually.
Note that Google Sheets behaves here differently from MS Excel. In Excel I get the desired behaviour very easily and intuitively: I create a rule for a row, select it, copy, then paste special formatting only. For a scale from smallest red to biggest green, this is the output:
!Excel colour scale example]1
If I do the same steps in Google Sheets, the output is quite different:
It is clear that GS does not duplicate a rule, but simply adds a new range to the computed joint range the original rule applies to.
Is there a way in GS to do the same conditional rule duplication that Excel does, or I just have to re-create it manually?
Click any cell covered by the original conditional formatting
In the menu, pick format/conditional formatting...; this opens a side panel with all conditional formats that apply to that cell
Click the format you want to duplicate
Do not edit anything yet
Click "Add another rule" on the bottom. This will save any changes you made to your original format ... and open a new clone.
Change the range on the newly created clone.
Repeat 5 and 6 until you enter the last range
Click "Done".
I am not saying I LIKE this answer, but it is the only solution I can come up with:
Apply Custom Formatting using a Custom formula for each color value. In your example, this means 6 entries in the Custom Formatting. For each one, use the below formula. For the Highest value, use:
=A1=LARGE($A1:$G, 1)
For the second highest value, use:
=A1=LARGE($A1:$G, 2)
Increment the last number for each ranking, setting a color for each as well. I hope your range to Z does not mean you are color coordinating that many items. My concern there would be not just having that many conditional format items, but having that many colors be meaningful.
There is also the MAX() and MIN() functions if you just want the highest and lowest.
=A1=MAX($A1:$G)
or
=A1=MIN($A1:$G)
as well as MEDIAN() and SMALL() which is the opposite of LARGE(). In case you want the X largest and Smallest, or Maximum, Minimum, and Median.

Skip yAxis gridLines if there is no data in them

I am trying to create a simple chart where xAxis is the date the user selected an attribute while yAxis is the attribute the user selected.
Each attribute corresponds to a value starting from 0. So for example, attribute0 has a value of 0 and so on.
What i would like to do is to not display yAxis grid lines for attributes that were not selected by the user.
As can be seen in the screenshot the user has selected attributes 3,4,5 and 9. The problem is that i don't want to show yAxis grid lines for the rest of the attributes(1,2,6,7 and 8) while preserving the value of the displayed attributes. This means that i want attribute 9 to have a value of 9 even if it is displayed in line 4 in this example(assuming that there is a way to skip empty gridLines)
The end result i would like to be like this for this example.
If the user selects a new attribute the next day, one that does not already exists in the graph, this attribute should be added in the same way.
Any ideas?
I hope i am explaining my self correctly.
Thank you in advance.
You can do this by using categories on the y axis.
Your y values then need to be the category index of the selected value, rather than the value itself.
So, in your example, you would have:
categories = ['3','4','5','9']
And the y values for that would be 0,1,2,3 instead of 3,4,5,9.
Something like (random x value used):
data: [[100,0],[100,1],[100,2],[100,3]]
Example:
http://jsfiddle.net/3d3fuhbb/62/

Conditional formatting, entire row based

I've searched and read through answers related to conditional formatting, but I can't seem to get mine to work, so maybe I'm doing something wrong.
I have a worksheet for work. It contains a list of animals in our shelter. What I'm attempting to do is color the entire row green if they've been adopted (noted by an "X" in column "G"). I've had =$G$2="X" and =$G2="X", but neither work. It'll only color the one row that was active when I set the rule, and when I enter "X" in another row, it does nothing. What am I missing?
Use the "indirect" function on conditional formatting.
Select Conditional Formatting
Select New Rule
Select "Use a Formula to determine which cells to format"
Enter the Formula, =INDIRECT("g"&ROW())="X"
Enter the Format you want (text color, fill color, etc).
Select OK to save the new format
Open "Manage Rules" in Conditional Formatting
Select "This Worksheet" if you can't see your new rule.
In the "Applies to" box of your new rule, enter =$A$1:$Z$1500 (or however wide/long you want the conditional formatting to extend depending on your worksheet)
For every row in the G column that has an X, it will now turn to the format you specified. If there isn't an X in the column, the row won't be formatted.
You can repeat this to do multiple row formatting depending on a column value. Just change either the g column or x specific text in the formula and set different formats.
For example, if you add a new rule with the formula, =INDIRECT("h"&ROW())="CAR", then it will format every row that has CAR in the H Column as the format you specified.
=$G1="X"
would be the correct (and easiest) method. Just select the entire sheet first, as conditional formatting only works on selected cells. I just tried it and it works perfectly. You must start at G1 rather than G2 otherwise it will offset the conditional formatting by a row.
To set Conditional Formatting for an ENTIRE ROW based on a single cell you must ANCHOR that single cell's column address with a "$", otherwise Excel will only get the first column correct. Why?
Because Excel is setting your Conditional Format for the SECOND column of your row based on an OFFSET of columns. For the SECOND column, Excel has now moved one column to the RIGHT of your intended rule cell, examined THAT cell, and has correctly formatted column two based on a cell you never intended.
Simply anchor the COLUMN portion of your rule cell's address with "$", and you will be happy
For example:
You want any row of your table to highlight red if the last cell of that row does not equal 1.
Select the entire table (but not the headings)
"Home" > "Conditional Formatting" > "Manage Rules..." > "New Rule" >
"Use a formula to determine which cells to format"
Enter: "=$T3<>1" (no quotes... "T" is the rule cell's column, "3" is its row)
Set your formatting
Click Apply.
Make sure Excel has not inserted quotes into any part of your formula... if it did, Backspace/Delete them out (no arrow keys please).
Conditional Formatting should be set for the entire table.
You want to apply a custom formatting rule. The "Applies to" field should be your entire row (If you want to format row 5, put in =$5:$5. The custom formula should be =IF($B$5="X", TRUE, FALSE), shown in the example below.
Use RC addressing. So, if I want the background color of Col B to depend upon the value in Col C and apply that from Rows 2 though 20:
Steps:
Select R2C2 to R20C2
Click on Conditional Formatting
Select "Use a formula to determine what cells to format"
Type in the formula: =RC[1] > 25
Create the formatting you want (i.e. background color "yellow")
Applies to: Make sure it says: =R2C2:R20C2
** Note that the "magic" takes place in step 4 ... using RC addressing to look at the value one column to the right of the cell being formatted.
In this example, I am checking to see if the value of the cell one column to the right of the cell being formatting contains a value greater than 25 (note that you can put pretty much any formula here that returns a T/F value)
In my case I wanted to compare values in cells of column E with Cells in Column G
Highlight the selection of cells to be checked in column E.
Select Conditional Format: Highlight cell rules
Select one of the choices in my case it was greater than.
In the left hand field of pop up use =indirect("g"&row())
where g was the row I was comparing against.
Now the row you are formatting will highlight based on if it is greater than the selection in row G
This works for every cell in Column E compared to cell in Column G of the selection you made for column E.
If
G2 is greater than E2 it formats
G3 is greater than E3 it formats etc

How does a DBGrid component determine initial column widths to display?

I'm having a difficult time saving/reloading col widths in a DBGrid (actually TMS's DBGrid). TMS includes built-in methods to save/reload col widths, which are working correctly (I can read the values in an ini file). Something, somewhere in my code is overriding the stored values, however. I don't know enough about how col widths are determined to be able to debug the issue.
The grid is ultimately connected to a ClientDataSet file.
TColumn has a method named DefaultWidth, which is called in particular when the width hasn't been explicitly assigned to the column (which is true for the dynamically created grid columns).
Basically, it takes the column's associated field's display width (in chars) and multiplies it by the width of the 0 character (in pixels), using the corresponding font.
It then compares the result to the width of the title (in pixels) and returns the greater value.

Resources