I am having job portal for testing. I am testing that once job seeker update his/her resume then actually all field data is updating or not?
I have automated above for easy and fast regression testing. At this time I am doing like :
1 - Store resume data in to excel - Before Update
2 - Update Resume data
3 - Store resume data again into same excel - After Update
4 - Now I am comparing cell data of Before Update & After Update one by one and checking that if data matches or mismatches. If data mismatch then it means data updated.
So Am I doing it in right way? Is there any other easy way in selenium webdriver to check above things , I mean to check whether data is updated or not?
I can suggest you 2 approaches:-
1) Without using excel sheet:-(Recommended)
- you can use hash map(key-value) to store data before updating resume.
- Then After updating resume, you can store updated values in another map.
- Now, you can compare both map data.
2) Using excel sheet:(Only if you need to data for future reference)
- Yes, in this case, as you did, save data in 2 different sheets of same worksheet of an excel file.
- Use poi jar, to retrieve and write data in these excel sheets.
- Compare data for verification. But using excel should be avoided if not required to store data for future reference. Excel have chances to get corrupt and also excel connection is little bit time consuming as compared to 1st approach.
Related
This is to create a bot that updates the existing CSV file with the latest available data from the new CSV file that is downloaded at regular intervals.
I am unable to figure out the logic. Need your help.
Step 1: I am accessing the following website,
https://www.marketwatch.com/tools/stockresearch/globalmarkets/intIndices.asp
Step 2: I am downloading the Tables from the above website and saving a CSV file.
Step 3: I am comparing the OLD CSV file with the NEW CSV FILE and updating the values in the OLD CSV.
Step 4: If there were changes made there is a status column and in the corresponding row I need to update "Value Updated" or "Latest Value Exists"
When you extract data from CSVs/Excel workbooks you can set a session name other than Default. By doing so this will allow you to build for each functions to loop through both file, comparing and flagging differences if needed.
You should make sure that the indexes counted in the for loops are the correct ones as some mix ups could happen.
Read the excel using database commands and then compare between them.
There are multiple ways to do that externally & internally -
Let's talk about one of the ALGO(Only using the Commands that are available in AA) -
STEP 1 : OPEN BOTH CSV's IN DIFFERENT SESSIONS AND GET THE COLUMNS(WHICH NEEDS TO BE COMPARED) SAVED TO INDIVIDUAL LISTS.
FOR EX: IF I HAD TO COMPARE COLUMN 1's DATA OF X.CSV WITH COLUMN 2's DATA OF Y.CSV THEN,
A) CAPTURE COLUMN 1 DATA OF X.CSV (FILEDATA COLUMN) TO LIST - lstColumn1
B) CAPTURE COLUMN 2 DATA OF Y.CSV (FILEDATA COLUMN) TO LIST - lstColumn2
STEP 2 : COMPARE BOTH DATA
FOR EX :
A) COMPARE -
IF (lstColumn1=lstColumn2)
GO TO ("PLEASE MENTION CELL NUMBER")
UPDATE WITH "SPECIFIED VALUE"
This logic will provide you the best case results with respect to time complexity and without using the external code. You can, however, achieve a quicker one with a metabot implementation.
For downloading a similar use case bot you can visit this link - https://botstore.automationanywhere.com/bot/excel_comparison/
I have no previous experience in Access, VBA coding or in Excel macros prior to teaching myself the past month via these forums. Thank you forums and contributors. I have enjoyed my Access learnings so far, the challenge that it has provided and appreciate any help that I can get. As such, the code and methods that I have used to this point may well be convoluted and confusing. I will do my best to provide relevant details and accurate terminology.
I work in a lab and I am creating an Access Form for semi-automated reporting. Samples are received from clients and are logged into the Excel Table R&D Log. The worksheet is InProcess. Samples are sorted based on the site in which they originate and given a one or two letter site code (G, D, WH, etc.) and an ID "yy-000" in separate Excel columns (i.e. D 18-096). Samples may be submitted for multiple analyses (Metals, Water, Soil, etc.) and may even have multiple rows of reporting if multiple analytes are identified in the sample. There are several other columns, such as receipt date, reporting date, units, etc. Once samples are reported, I manually copy and paste them into the Archived worksheet, and delete the record and blank row from the InProcess worksheet. Since one sample may have multiple analyses and even more potential results, each record would be reported on a new Excel row (with the same D 18-096 ID number). Thus, there is not a single unique identifier or primary key for each sample in the current format. R&D Log is updated manually by lab technicians and the worksheet InProcess is a linked table in an Access Database.
The Access Database is using two combo boxes on a Form frmInProcess to filter a Query qryInProcess of the linked table. The combo boxes are filtering the report destination (one client may receive multiple site codes) and the analysis (reports are separated based on type of analysis). The Query is also filtering out blank results and blank dates, so only completed samples will appear on the filtered Form. I have generated VBA code to this point that will export the Form to a .pdf, save the file with unique filename, and open outlook to mail out the report. I have also managed to export the filtered Form frmInProcess to an Excel file Access Test (not the linked file).
What I would like to do now is to automate the transfer of completed test results from the Excel worksheet R&D Log: InProcess to R&D Log: Archived and delete the record from the InProcess worksheet. I am not sure if I can export the filtered Form into a linked Excel table, or if I must use a separate Excel file (or if it even matters for simplicity of code?). I would now like to read the exported filtered Form in Excel Access Test, lookup matching rows in R&D Log based on several criteria (site, ID, Analysis, Analyte, Report Date) and automate the transfer of records between R&D Log worksheets. End result being that Access generates reports for completed tests, and the records are removed from InProcess testing and transferred to Archived testing in Excel. I am guessing that I may need to close the Access application and perform this in Excel. Hope this is easy enough to follow.
Thank you.
In my experience, importing an Excel document into a temporary NEW (or totally empty) Access table is usually the easiest way to go. Then you do not have to worry about cell references like you do in Excel VBA. Even if the Excel document has old data in it with just a few new changes each time, importing it into a temporary Access table could be the simplest way to go, because then you can compare the data in this table with the data in another, permanent Access table and update the latter based on the former.
As far as the original Excel file, if you need to delete rows there, it might be quicker to export a new Excel file with just the data the old one is supposed to end up with, and then use VBA to delete (or - safer! - rename) the old file.
So the development process goes something like this:
Save import steps by first importing an Excel file via Access' ribbon options "External Data" (tab) ->"Excel" and when you finish, be sure to check the "Save import steps" box and note the name you give the "saved import" because you will need that in your VBA code.
In Access, write a function for deleting the table. The VBA code is:
Const cTable = "MyExcelTempTable"
If TableExists(cTable) Then
DoCmd.DeleteObject acTable, cTable
End If
Now you can test your delete function on the data you imported.
Write VBA code to import the same spreadsheet to create the same table:
Const cSavedImport = "Import-MyExcelTempTable"
' Import the Excel file
DoCmd.RunSavedImportExport cSavedImport
Write more VBA function(s) to check the imported table for bad data and then to copy it into the permanent table. You might be updating existing records or adding new ones. Either way, you could use Access queries or SQL to do this and run them from VBA.
Write a VBA function to rename the old Excel file. (You could use an InputBox if the Excel file name is different each time. I do this for importing Excel files, and I set a default value so I do not have to type as much.)
Write a VBA function to export the new version of the Excel file.
Make yourself a button on a form that, when clicked, runs a VBA function. Inside that function, run Steps 2 through 6, above.
I am not sure my answer exactly matches what you are trying to do, but hopefully you get enough of a picture of the workflow to figure out the details of what you need.
I am not looking for help with any specific vba coding, just peoples ideas on the best approach to handle a couple of scenarios. The solution has to work with Excel 2007 onwards (can not use Get & Transform / Power Query). In both cases the idea is to have a Master document in to which raw data is updated each week. It should not be necessary to manually redefine any of the formulas or references in the Master document after the update process in order to summarise / analyse the data.
Scenario 1 : Weekly sales figures for various products received from six different retail outlets in the form of an .xlsx file. The data is contained on one sheet in each file. Although the product lists are the same the layout of the data from each outlet is different and a 'standard' template will not be introduced. The user needs the ability to manually select each file to include in the update. The data from each outlet needs to be combined in the 'Master' document for additional processing etc.
What would be the best way to automate the Master document update process?
Possible idea : in the Master spreadhseet create an MS Query for each outlet to import the data from each outlet in to separate sheets in the Master spreadsheet. For each outlet the user would be prompted to identify the file and its location using Application.FileDialog(msoFileDialogOpen) and the response used to modify the connection string prior to running the Query to retrieve the latest information.
Scenario 2 : Multiple workbooks received each week (80+) containing employee time and attendance data. The workbooks are saved in a single folder. The layout and format of the workbooks is the same with the data presented on one sheet in each. The data needs to be combined in the Master document for analysis.
What would be the best approach to allow the user to identify the workbooks and the transfer the data from these in to the Master spreadsheet for processing. Can not use the 'From Folder' in Get & Transform as it must work in Excel 2007 upwards.
Thanks
What would be the best approach to allow the user to identify the workbooks and the transfer the data from these in to the Master spreadsheet for processing? I think you need to hook into this AddIn, as described below, and all your questions will be answered.
https://www.rondebruin.nl/win/addins/rdbmerge.htm
In my Access 2013 Desktop database, I want to validate an Excel form through VBA before importing its rows to a table.
The problem is that the imported Excel table may contain in the same column values that are numeric, string, null, etc. depending on the row due to mistakes from the user, so these values have to be initially of VBA type Variant before validation.
If the row is invalid (e.g. one value is not of numeric type while it should be, one mandatory field is null, etc.), I want to be able to store its values and let the user correct it later on. I am therefore looking for a way to build a table where I could store these rows, but where the fields are kept intact, so with the possible mixed data types.
This seems not to be possible, as Access tables need apparently to have fields of a defined type, so nothing equivalent to Variant.
How could I achieve this? What would be the simplest and most efficient way to store rows of Variant values while keeping the structure of the columns? The only way I could think of so far is to concatenate these values for each row in a string using some defined separator, and store this in a String column in an Access table, but maybe there is an easier way to do?
Thanks a lot for your help.
EDIT: Reading your answers I realized that I forgot to specify that the people filling and sending the Excel forms (who typically do not have Access on their computers) are not the same users than the ones who have the Access database and need to import the data. In this configuration it is impossible to use directly Access forms to input data, which would of course simplify tremendously the task. While we try to enforce rules for people who fill the Excel form at the first place there will be mistakes and the Access application needs to cope with them. And the importing process for the users manipulating Access should be as simple as possible (these users are not experts in IT).
I though about your problem for a while and made a few notes as I thought below.
I would strongly advise that unless the excel workbook is providing other functionality that you do not use excel, but create an simple Access database with a form they can use to interact with "their" data. They do not necessarily need an Access license to do this. Access 2013 even has new web features that can be used if you have sharepoint to collect data via a Access created web frontend.
If you are to collect data in Excel, then you must use excel validation and VBA code to validate the data as much as possible before transferring to access.
There are complexities that may or may not be an issue for you, things like:
Can users edit/created/delete the same rows concurrently - what happens if they do! You may need to "lock" rows when they are downloaded from Access. But what happens if tow users add the same record, or ones deletes a row before another user commits it back again.
Can a user open multiple excel files and edit the data they store without committing the data to Access?
Can multiple users login to the same Workbook with uncommitted changes and edit the data.
Using access will simplify your code as it will be able to prevent erroneous data being entered and remove the need to deal with the above issues and others
In summary you are using excel as a front end "form" to data stored in Access.
Each excel file can have data that has yet to be up
I would suggest that the primary key of a row is the "path and name" of the excel file that was used to create it & a unique numeric identifier. The unique identifier is a counter that is maintained for each excel file. The "path and filename" could be replaced by a unique identifier created for each file.
Many users enter data using multiple instances of Excel into a form which results in one or more rows being updated/inserted/deleted in an Excel table stored in each spreadsheet.
I would expect that whenever Excel is opened the user enters a username and excel will grab "their data" from Access. Alternatively a workbook might be set up for each department or "case type" and only interact with data that matches this "custom criteria set up in the workbook". Excel would not necessarily need to store data itself longterm. The workbook might always save data back to the database when it is saved.
You say Excel VBA performs limited validation on the data (but no complete validation). It should be used as much as possible and arguably should be able to do exactly the same validation that access can do. At the very least it should enforce datatypes etc (eg using the standard data validation rules on the excel data menu) or perhaps use VBA/controls to get any access data it needs to validate the data entered.
After updating the data the user can "commit" (ie save) the data to the access database. Before closing the workbook you might want to commit the data.
(An issue is whether a user might open many workbooks perhaps on many machines without committing the data.)
An Access "staging" table can be created with all columns having the datatype "shorttext" and not-required.
The process that loads data from an excel table into Access, will uploaded all excel rows into this staging table. It will then validate each row in the staging table and process all valid data into the main table(s) that have data types, relationships constraints etc.. Any valid rows in the staging table are flagged as "VALIDATED & TRANSFERRED", Invalid rows are flagged as INVALID. The "VALIDATED AND TRANSFERRED ROWS" are subsequently ignored, but kept so you can check what processing has happened, perhaps only whilst testing.
The data in excel is then updated with the Valid/Invalid status from Access and suitable messages given to the excel user. The user may correct and then re-commit the data.
Each excel file has a status of "changed/Unchanged" to indicate whether a user has changed data in the file.
When a user opens an excel workbook and status is unchanged it will refresh it's data. If it's changed a refresh probably can't be done.
In order for the data in Access to be updated/deleted/inserted with the changes made in Excel, there will need to be a unique identifier for each row that cannot be changed by the users in excel. This is likely to be the Path&Filename or the UserName logged into Excel and a numeric counter (which is maintained for each file or user). (This assumes that the user will have to commit changes in one excel file before they work on another.)
Anyway, without knowing more it's difficult to fully design what you will need, but I hope these thoughts help you
Harvey
breaking my head about this and searching as far as I could, to no avail...
What I have:
Two XLS Sheets to be imported into one Access DB.
Data is structured the following way:
Table 1 - Master Data (one row per Submission)
User Project Date From Date To
Table 2 - Detail Data (up to ten rows per Submission)
Date Start Time End Time ....
While those two tables are imported into the same Access db, they are going into different db tables, so I Need a master key to link the master to ist subsequent Detail data set.
What I am therefore looking for is to generate a GUID which will be attached to both data sets and can be used for joining the sets in Excel.
I have been trying both, to generate an ID in Excel (VBA or formula) or add it when importing into acccess, when importing, have not found a proper way to achieve this.
Maybe there's an alternative Approach to my requirement, curious for ideas.
Thanks!
I've had luck with the following:
Public Function GenerateGUID() As String
GenerateGUID = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36)
End Function
(Found here: https://stackoverflow.com/a/23126614/1240745)