Eggplant Functional comparing a value in csv to an readtext of image - eggplant

I am trying to complete foundation certification and on lesson 5 I needed help to complete the exercise.
I know how to read a csv (myResults)
put fourth item of line 2 of myResults into color
say color value = purple
I need to select the matching radio button ( Purple, Orange, Yellow)
ReadText("Purple"), ReadText("Yellow") or ReadText("Orange")
Click allows web element, image, text, characters but not a variable. How do I do that? Need to select the correct radio button based on value in csv.

The documentation for Eggplant Functional is confusing at the best of times but it is possible to identify the image you want to click using a variable containing a string. The click command takes a parameter called an image reference which can be an image name, image collection, image property list, or character collection. It doesn't matter to click whether the image reference is passed as a variable or as a hard coded value.
You need to create a mapping between the string you extract from the CSV and the name of the image you are wanting to click. There are many ways you could do this but one solution would be to switch on the value you extracted from the CSV and define a variable with the name if the button you want to click based on that value.
Say for the sake of argument the values you are getting from your CSV are in the form "prpl", "ylwo", and "orng", and the names of the images you are wanting to click are "purpleButton.png", "yellowButton.png", and "orangeButton.png". If this case the code to click the correct button would look something like this.
// In your actual code this value would be set from CSV
set valueFromCSV to "prpl"
if valueFromCSV is equal to "prple"
set buttonToClick to "purpleButton.png"
else if valueFromCSV is equal to "ylwo"
set buttonToClick to "yellowButton.png"
else if valueFromCSV is equal to "orng"
Set buttonToClick to "orangeButton.png"
else
error("Unable to identify color code from CSV")
end if
click buttonToClick
If you are working with a consistently designed CSV, and consistently named images it could be possible to construct the image names by manipulating the values you are extracting from the csv. For instance if the values you are getting from the CSV are "purple", "yellow", and "orange", and the images are named "purpleButton.png", "yellowButton.png", and "orangeButton.png", you could construct the names of the buttons with logic like this.
// In your actual code this value would be set from CSV
set valueFromCSV to "purple"
set buttonToClick to valueFromCSV & "Button.png"
click buttonToClick

Related

Google Sheets consecutive rows when multiple checkboxes are ticked

I am looking for help with this sheet. I have some item names and images next to those. They belong together.
Whenever I tick the first checkbox in the item sheet, I want the item name and the image to be displayed in Sheet 2. I have managed to do that with the formula in A1 for the image
=Iferror(VLOOKUP(B1,Items!B4:F15,2,FALSE),"")
and for the item name formula in B1 I used
=iferror(QUERY(Items!B4:F15,"select B where D=True"),"") .
My problem is:
When I tick the first checkbox of any item, the item gets normally displayed in Sheet2 with the belonging image. When I tick the second checkbox for that same item (x2), I want the same item to be displayed right again in the second row in Sheet2 with the belonging image again. If I tick the third checkbox, I want it to be displayed three times basically below each other with the belonging image.
Is that possible without scripts?
https://docs.google.com/spreadsheets/d/1tjyBIMDWbM4AxuQby4vmEUeFgqLbxN1EPk1pGqEX_64/edit?usp=sharing
You can try
=sort(filter({
ifna(filter(Items!B4:C,Items!D4:D),{"",""});
ifna(filter(Items!B4:C,Items!E4:E),{"",""});
ifna(filter(Items!B4:C,Items!F4:F),{"",""})},query({
ifna(filter(Items!B4:C,Items!D4:D),{"",""});
ifna(filter(Items!B4:C,Items!E4:E),{"",""});
ifna(filter(Items!B4:C,Items!F4:F),{"",""})},"select Col1")<>""))
UPDATE: Better approach
=sortn({
ifna(filter(Items!A4:B,Items!D4:D),if({1,1},char(999)));
ifna(filter(Items!A4:B,Items!E4:E),if({1,1},char(999)));
ifna(filter(Items!A4:B,Items!F4:F),if({1,1},char(999)))},
countif(Items!D4:F,true),,2,1)
Essentially we are filtering the data three times (one for each checkbox), stacking all the results together and sorting them in ascending order. The if({1,1},char(999)) is used as padding in case there's no match (i.e. no checkbox is ticked) to prevent ARRAY_LITERAL. The idea with char(999) is to have a character that goes to the bottom of the list when the range is sorted so we can exclude it with sortn(). I don't know how Google Sheets sorts when special characters are involved (if anyone does please let me know) but char(999) seems to get the job done.

FileMaker Pro TextColor as a calculation for a field in a table

I have a list of colors that we use and I am creating an app where I am storing the RGB values of those colors in 3 fields R, G & B. Then I have another text field in which I used this ██████ Unicode block of text and used a script to SET FIELD and then calculated the TEXT COLOR of this field to display the correct color as per RGB values by using script trigger whenever the RGB values are modified. Everything works well.
Now what I want to do it display all the color names and the correct color in a portal. The problem is all the RGB values are taken from the current record and so my portal shows different color names but the Unicode block of text is always in the same color. Any ideas on how can I correctly incorporate this? I tried Googling and even skimmed through the documentation of FileMaker but could not figure out a workaround.
Thanks!
It is difficult to understand your structure. If you have "a list of colors" then you should have a table of Colors, with fields for R, G, B and a calculation field for displaying the swatch - all in the same table.
A portal to such table will show one row per record - and each row will show the fields from the corresponding record, including the swatch field.
There should be no need to use any scripts or script triggers for this.

Editing labels of series in Google Spreadsheets

I have data listed in columns as below and by highlighting it all including the names and the units and then clicking Insert -> Diagram..., I can easily make the following graph:
The labels are correct LabelA, Labelb, and LabelC in this case.
But if the label names are not in the same column as the data, then I cannot make this graph. In the data structure below where names and data are in different columns, I again highlight all data cells as well as their units and names (by holding down the ctrl button and clicking all the cells with the cursor):
It is clear that the software does not know that it should assign the names as labels. Is there a method to make the graph show the correct labeling as in the first scenario but with the second scenario's data structure?
you could combine the data in another place with formula:
={{A1,C1,E1};{B4:B6,D4:D6,F4:F6}}
and then plot the diagram as usual.

Highlight entry if not 17 numeric digits

Basically, I'm part of a community and when someone applies for membership, they have to provide a Player ID in their application. When we accept their application, we copy information into a Google Spreadsheet about them such as Player ID's and GUID. We want a way of indicating on our spreadsheet if the Player ID is incorrect. If the number put in is less than 17 digits in length or is any bigger, it would indicate that it's wrong by either formatting the cell to be a light red or it being replaced with "ERROR". I just need something that would indicate if it's incorrect.
Go to Format tab in the google spreedsheet, then go to Conditional Formatting, then in the Apply to range box, put down your range, say A1:A30 the range where you want to apply your formatting. Then, in the Format cells if, choose Custom formula is, the last one in the dropdown list. Then put this formula in the formula box just below it:
=and(not(len(A1)=17),not(isblank(a1)))
then in the formatting style, choose any color that suits you. Then click DONE. It should work!
Update
in a helper column, say column B, you can put this formula in B1 and copy down until the last row:
=If(isblank(A1),"",(IF(LEN(A1)=17,"OK","ERROR")))
this should work

Operations on the controls within the repeater control

A form in a Orbeon form builder contains a repeater control(new repeat).Suppose there are three text controls on each row(or repeat) of a repeater control(new repeat).first two text controls on each row contains numeric values.I want to bring the product of first two text controls to the third text control at run time without any event.there will be multiple numbers of repeat in the runtime ,i.e the row may increase but for each the calculation much reflect at runtime and for each row product of first two must be viewed on the third one
Name the fields in the first and second column (click on cog wheel to the right of the field). Say you picked the names quantity and price.
For the 3rd field, enter the following XPath expression in calculated value, all in one line (in the Edit Validation Properties you get by clicking on the red exclamation mark):
if ($quantity castable as xs:double and $price castable as xs:double)
then $quantity * $price
else 'n/a'
You refer to other controls by name, preceding the name by a dollar sign, and here we check that a value is indeed a number with $gaga castable as xs:double.

Resources