Randomizing starting row input in imacro - imacros

If I have a !DATASOURCE csv input file with 50 first+last names in two columns, how do I write an imacro that grabs a random first & last name from the list to plug into an online database? I know that once the random row is selected I can just use CONTENT={{!COL1}} and {{!COL2}}, but how can I randomize which name is selected every time I run the imacro?

Try to use these commands:
SET randomRow EVAL(1+Math.floor(Math.random()*50))
SET !DATASOURCE_LINE {{randomRow}}

Related

How get display value of checkbox in a checkbox group?

I am using APEX 21.1. I have a checkbox group whose list of values is retrieved using a query...
select disease, id from history;
The query returns many checkboxes. I have another textarea item. I need to get the display value for any checkbox whenever it's checked and set item HISTORY to that value. How to do so?
Describing a how-to would be so much easier if you had provided some example page item names and example data. So, lets call your checkbox group P10_CHECKBOX and your textarea P10_TEXT.
Usually, your checkbox group will save the item ids as a colon seperated list, like this: 3:4:5
To display the corresponding display values, make a dynamic action on change on your item P10_CHECKBOX.
Then, use an action of type Execute PL/SQL Code to fetch the display values of your items.
The code could look like this:
select listagg(disease,chr(10)) within group (order by disease) into :P10_TEXT
from history h
join table(apex_string.split_numbers(:P10_CHECKBOX,':')) t on (h.id = t.column_value);
apex_string.split_numbers will convert your colon list into an actual "table" with the column column_value you can use in the join clause. listagg will do the actual concatenation and will work up to a couple thousand characters. chr(10) is an ordinary line break and will have your items be shown line by line, but any other seperator will do.
Last step is to set up P10_CHECKBOX in your Items to submit and P10_TEXT in your Items to return.
Now, whenever you click a checkbox, the textarea will be updated immediately.

ImportRange for last non-empty column

I'm trying to import current inventories from google-form based inventory sheets for multiple rooms (each room's inventory is on a different sheet). I'd like to import the last non-empty row/column from another sheet using ImportRange or similar to grab the last inventory that was done for that space. I've also tried importing these inventories into another sheet in the same document and use the "Sheet 1"!A:A format to grab the last occupied column, but I haven't found a way to grab all 42 cells in the column without needing to type them out one at a time using this formula
"=FILTER('Sheet 1'!2:2 , COLUMN('Sheet 1'!2:2) =MAX( FILTER( Column('Sheet 1'!2:2) , NOT(ISBLANK('Sheet 1'!2:2)))))"
But that just grabs a single cell , instead of the whole column. Any suggestions?
getting the last column:
=ARRAYFORMULA(INDIRECT(
ADDRESS(2, MAX(IF(2:2="",,COLUMN(2:2))))&":"&
ADDRESS(ROWS(A:A), MAX(IF(2:2="",,COLUMN(2:2))))))

How to analyze what set of ten numbers is repeated? (LOTTO)

How to analyze what set of ten numbers is repeated?
Each set has 20 different numbers. From 1 to 80.
How to do it in EmEditor text editor?
Example:
03,04,05,09,12,15,20,24,26,28,31,33,35,37,43,48,64,70,72,75
06,05,07,10,12,15,21,24,30,28,31,39,35,37,43,49,64,70,72,76
CSV File:
https://www25.zippyshare.com/v/0gLFugWf/file.html
This uses the Bookmark Duplicates dialog to bookmark all duplicates.
Change the User-defined CSV format to use the ";" delimiter. If you don't see the CSV toolbar, go to View | Toolbars | CSV/Sort toolbar. Go to Customize CSV for User-defined format and change Delimiter to ";". Press OK, then click on User-defined separated to go to view the file as a table.
Go to Delete/Bookmark Duplicate Lines (Advanced).
Change the settings like in the screenshot. I'm only looking for duplicates in the lotto numbers. Press the Bookmark button.
At this point, the duplicate entries are bookmarked. The status bar at the bottom shows the number of duplicates. You can navigate the bookmarks with F2 and shift+F2.

How can I combine multiple where (and or) statements?

I can get my code to work but only if I split it into two data steps. When I combine, I get an empty set as a result. Ultimately I want one month of data, but only the record that contains one of 6 keywords.
Example of code that does not work:
data d_prep;
set DataTable;
where
(CREATIONTIME ge "01DEC2017"d) and (CREATIONTIME le "31DEC2017"d)
and
(TEXT contains 'Initialize VNC'
or TEXT contains 'FT-Download'
or TEXT contains 'FT-Upload'
or TEXT contains 'Remote Session'
or TEXT contains 'Login of user'
or TEXT contains 'Create AdHoc-Action');
run;
This gives me zero observations. However, if I split into two steps, I get it to work:
data d_prep;
set DataTable
where
(CREATIONTIME ge "01DEC2017"d) and (CREATIONTIME le "31DEC2017"d);
run;
data d_prep_1;
set d_prep;
where
TEXT contains 'Initialize VNC'
or TEXT contains 'FT-Download'
or TEXT contains 'FT-Upload'
or TEXT contains 'Remote Session'
or TEXT contains 'Login of user'
or TEXT contains 'Create AdHoc-Action';
run;
Good day, Since you are using where environment, I found cool feature ? it essentially is contains:
data wanted;
set begin;
where var1 <10000 and var2=2016 and (TEXT ? 'mobile' or TEXT ? 'scout');
run;
I tested this with data and seems to be working.
Check the SaS documentation for this trick.

vlookup to find match and return another element in row

i have two sheets. first column of both sheets has userids, but there is only some overlap of ids between the two sheets. i want to keep the userids in the first sheet, but in the second sheet, the second column has a point of data that i want. for those userids in the first sheet that are also in the second sheet, i want to get this data.
so, for say the first row's userid in the first sheet, how could i use vlookup to find that same userid in the second sheet (if it exists), get the value of the second column of that match, and bring it back to the second column of the first sheet?
thanks
Modify and put this formula into the first cell of the second column on the first worksheet. Then copy and paste it down the column:
=VLOOKUP(A1, Sheet2!A$1:B$100, 2, FALSE)
Let's look at the parameters for this function:
A1: This value, on this worksheet, is what we're searching for in the range given in the next parameter. When you copy and paste the entire formula down the column, it increments the row # with each row. In row 2, it will be modified to A2, and so on.
Sheet2!A$1:B$100 : This is the range that we are interested in, on the second worksheet. It is the top left to bottom right cell. The $ symbol tells Excel not to change the row #'s when you copy and paste the formula down the column. Modify B$100 to fit the range of data you are interested in... something like B$30 if you only have 30 rows of id's on the 2nd sheet.
2: This is the column you are interested in retrieving the value, relative to the above parameter. In this case, the 2 corresponds with column B.
False: This instructs Excel to find the exact match.