Generate Dynamic data in cucumber table - cucumber

Hi I want to generate dynamic data in the cucumber tables:
Feature: Generate dynamic data
Scenario Outline:
When open url
Then get the price list and save to "Price List" in context
#Note: Price list is an array and returned as [10, 20, 30, 40] and this is dynamic
When send "<singlepricelist" to server
.......the remaining steps....
Examples:
| singlepricelist |
| <<Price List |
Question: In the step "When send "", I want to send the values present in arraylist one by one i.e. the said step in this example should run 4 times with the values 10, 20, 30 and 40.
Can I generate the dynamic data in the Examples so that the above step will run 4 times? Note: singlepricelist can take only one value at a time.
Thanks in Advance !!!

First of all, you cannot use the feature file to do any programming. So you cannot pass dynamic values from the feature file.
If you want to perform the above scenario with the listed values (10, 20, 30 and 40), you can add each of them as an example.
If you want the values to be dynamic / random, you can implement this in your step definition. In that case, rather than sending the values from your feature file, you would generate them in the implementation of your step definition. In that case I don't understand why you would want to run it 4 times.
To be honest, I don't understand your use case from the question. Can you explain the reason you want to send 4 dynamic values? (what is the problem you are trying to solve with this?)

Related

Multi select employees in Employee Time Activities

I was trying to enable multi-select for Owner in Employee Time Activities and wanted to try based on below article.
https://asiablog.acumatica.com/2018/01/multi-select-selector.html
Then override view like below:
https://asiablog.acumatica.com/2017/11/sql-in-operator-in-bql.html
However, after I added ValidateValue = false in field:
I am getting this error.
I looked at the custom attribute and I don't think it could be replaced with anything keeping the same implementation.
So, is there any other way I can accomplish multi select feature to allow display Employee Time Activities for selected employees at once besides the ideas mentioned above?
Thanks.
Your primary issue is that DimensionSelector is different than Selector.
Secondary thing to keep in mind that when you do Multiselector you would need to update the field that holds the values to have a longer length. The way a multiselector works is that it stored the saved values as a ; (semicolon) separated string. so if the field was 10 long you would want to expand to whatever you expect the max number of selected values would be, e.g. 40 would be 480, 40x10 + 40x2, 10 being the original size, 2 being a semicolon and space. (hope that makes sense :) )
Next you would have to update all the functional business logic to then parse that string and loop each, in this case, employee for the functions.
I am speaking very generically here. So not sure what you're actually attempting to do here, but one would assume that if you were selecting multiple employees you would want records to reflect accordingly.

Sort and find Top and Bottom 5 values and their corresponding names

I know this is not the first time someone is asking a similar question, but me trying to execute what I found out in other answers is not working exactly as how I want it to be. I hope someone here could help me.
I got four columns, the first one is the Product Name, and the last one is its P/L%. I want to sort out top and bottom 5 P/L% value along with their corresponding Product Name. I am attaching the screenshot of a sample scenario in case if you couldn't understand what I explained.
I tried the (sort(filter)) method as found somewhere else, but it actually messed up with the second and third columns. I hope someone here can give me some simple ways.
My solution considers the case when multiple products has same value in P/L% and I use a Table object for displayed data.
Formulas to use
Top 5 Gainers values
=LARGE(ProductTable[P/L%]; ROWS($H$3:H3)), and copy down
Top 5 Gainer values
Top 5 Gainers products name
=INDEX(ProductTable[Product Name];AGGREGATE(14;6;(ROW(ProductTable[P/L%])-ROW(D$2)+1)/(ProductTable[P/L%]=H3);COUNTIF($H$3:H3;H3))), and copy down
Top 5 Gainers products name
Top 5 Loosers values
=SMALL(ProductTable[P/L%];ROWS($H$3:H3)), and copy down
Top 5 Loosers values
Top 5 Loosers products name
=INDEX(ProductTable[Product Name];AGGREGATE(14;6;(ROW(ProductTable[P/L%])-ROW(D$2)+1)/(ProductTable[P/L%]=K3);COUNTIF($K$3:K3;K3))), and copy down
Top 5 Loosers products name
Short Explanation
You must use LARGE and SMALL functions when you want to get the largest or the smallest value in a data array.
AGGREGATE function is a little bit complex to explain here so I recommend you this link to understand better. Basically, I use this formula to get the row of the gainer or looser product name into INDEX function.
ROWS($H$3:H3) returns 1, but when you copy down this formula, you get 2, 3, and so on. This is a nice way to expand the query if you need more than top 5 values.
Similar problem in:
https://www.excelforum.com/excel-formulas-and-functions/1208726-index-match-large-and-duplicates.html

Generating a unique identifier list with multiple tables & criteria

I'm not a coder, just someone who uses excel for basic estimating functions at work. However I've found myself in need of a complex list or index system.
Background/Intent: (Skip below if doesn't matter.) In an apartment building construction they build buildings like opened books - mirror images of 2 bed 2 bath apartments, for example. There is a standard "typical" unit and then the mirror image across the hall, the "reverse" unit. The door swings are all opposite from one to the other. My job is to figure out how to give each door a unique identifier code based on: Bldg No., Unit Type, Door No., Door Swing (left or right.) The raw data tables are provided below.
I've attempted to clean this up as much as possible, but there are two steps (I think) to this process.
Step 1:
The raw data table is on the left. My output field is on the right. I want to be able to select a drag down box, like data validation list, and select the building. Then a formula (which one?) spits out a list of every unit type per building. For example, Bldg 5 has 2 each of "A1 Typ." How do I get the formula to recognize that if there are 2 of them, to produce 2 separate lines for "A1 Typ." And so on and so forth until all 41 occurences/units have been accounted for and labeled appropriately. Some occur once, some multiple times, and some zero.
Step 1
From there, Step 2.
I want to use this output field again to automate another sequence, this time pulling from a different table, see picture. Now, depending on the unit type under the "type" column, I want it to expand each unit type showing each indivudual door number (1,2,3 etc through 12) and if it's an L (LH) or R (RH), and if there is more than one, to list out each occurence. (what formula?)
Then the decriptor text that will pop up under "DOOR LABEL" column would just be a joining of several fields to give a unique identifier. (suggestions?)
Step 2.
Easy right? Is this too much for excel, or can this be done?
Thanks so much for considering helping me out!

Crystal Reports - my formula works, but when repeated in more than 1 subreport, all records disappear

I'm not a developer but I'm supposed to create a report by C.R., so excuse me in advance if it is an obvious question for you, and please keep in mind that I'm a real beginner.
I have a job composed of 3 different workings (3 out of 5, which is the maximum workings I can have for a job).
In my SQL database, the table.field corresponding to those workings is job.phase, so when I put, in my report details, the field "job.phase", I get 3 rows for that job.
The point is that my report printout always has to show 5 different text objects (one below the other), corresponding to the descriptions of all the 5 possible table.field-records, and a 'X' should appear next to text objects when each one of the workings listed there is a part of my job (otherwise nothing should appear).
What I have done is the following:
- created a subreport containing the "job.phase" field
- put it near my first text object
- specified in my subreport the following "show string" formula:
if job.phase = 'working1' then 'X' else ''
and it works: a X appears if working1 is part of my job, nothing appears if working1 is not part of my job.
Then I have created 4 subreports more, equal to the first one, and specified the same for job.phase = working2, working3, working4 and working5, BUT, after doing that, no X is shown (even though working 1, 2 and 3 are part of my job)...
Is there anybody who can help me, please? It's so frustrating...
Using subreports for something like this is overkill for what you're trying to do and could be causing any number of things to behave badly. I'd recommend you abandon that idea. Here's how I would do it:
The first thing you'll want to do is group by job (if more than one will appear in your report, which I'll assume it will). The Group Footer section is where you can display the labels and Xs. You'll need to create 5 formulas as you did before if {job.phase} = "working1" then "X", one for each of the phases/workings. Drop all 5 of those formulas into the Details section of the report and then suppress that entire section so that it doesn't display.
To show the Xs, you can use a Maximum summary in the Group Footer for each of the five formulas you created. To do this, right-click each of the formulas in turn, select Insert -> Summary. Choose Maximum as the summary, and "Group 1" (Your job ID or whatever field you are using to group the job) as the Location. That will insert a field into the Group Footer that will display an X when that particular working is specified for the job, otherwise it won't display anything. Move them to display next to the appropriate label/text field and you're done.

VB: Filtering data on excel table

In python, using libs to work with excel files, I could do what I want.
But now, because I'm trying to learn VBA, I need to ask this question.
I'm working on a worksheet that has around 12 columns, and 50000 rows.
This data represents Requests sent to the company.
The 5# column represents its code, 10# the time took to finish it.
But, for example, rows 5, 10 and 12 could belong to the same Request, and was just divided for organizational purposes.
I need to treat these data, so that I can:
Column 6# represent the person
who answered the request. So, I need
to put each request on the "person's
worksheet". Also, create this
worksheet for him before starting to
add requests to it.
For each person (worksheet),
contabilize request types (Column
2#) attended by him. I.e., create
another table on its worksheet
showing:
Type_Of_Request | Number_of_ocurrences
Create a final Report Worksheet, showing the same table
above, but accounting all requests
(without person filter)
Obs: I know that most questions on stackoverflow are to solve a specific question, but I'm asking for start routes here.
Or even solutions, if possible.
For explanation purposes, I think that explaining the algorithm used in python will help persons who know a little of python and VBA to help me here.
So, for each issue:
Create a dict that manages the 6# column data.
This dict will have the person's unique name as the key, and for each request that him answered, it will be added to a list pointed to his name (the dict key).
Something like:
{person1: [request1, request2, request3, ...], ... }
Another dict that manages the 2# column data (the request type).
Now, I will have a dict where each entry will have a list showing requests that are of that type.
After positioning all requests, I did a simple sum on the list, and filled a table with (key, sum(dict[key]))
where dict[key] is the list of requests of same type, and a sum on it returns the total of requests of that type.
Something like:
{request_type1: [request1, request2, request3, ...], ... }
Well, same of 2, but applying the algorithm on the initial complete table.
I don't know if VB has a dict type like python has (and helps a lot!), even because I'm new on VB.
Thanks, a lot, for any help.
vba does indeed have a dictionary type, but it's usage may not mirror python's implementation. (see: http://msdn.microsoft.com/en-us/library/aa164502%28v=office.10%29.aspx )
you can also create a user defined type ( see: http://msdn.microsoft.com/en-us/library/aa189637%28v=office.10%29.aspx )
If you have a working solution, that is your best jumping-off point. Many of the python string function etc are probably even named the same or close enough for you to easily find them in the language reference.
You may find this easier with ADO, which works quite well with Excel using the Jet/ACE connection. It also will allow to use rs.CopyFromRecordset to write suitable sets to worksheets.

Resources