So I’m trying to set where the user adds one line of text containing the Name(Last, First Middle) as well as id number, ssn, and birthday. Example: Doe, John Hank 12345678901 123-45-6789 Jan. 01, 1801
I first split it by using “ “ to break it up into the array. I then need to find which array value has the ssn in it. Because the name can change from Sr, Jr, no middle name, etc. the array value can’t be static at like ssn = eachpart(3). Is there a way to search each piece of the array with the criteria for a mask of a ssn?
You could create and array using Split:
Parts = Split(Input, " ")
Then loop this checking for
IsNumeric(Parts(i))
That found will be the ID.
The next will be the SSN.
Related
I have members emailing in for support instead of using the online support form and they are nice enough to put their Member ID into the Subject line. I would like to extract these Member ID from the Subject line to populate the Member ID field for the support ticket.
At the moment, I am able to use something like below to find the tickets where the Subject line has the string pattern which I am looking for (7 numbers in a row). My difficulty now is how to extract these numbers from the Subject line.
SELECT t.ID, `Subject`
FROM tickets AS t
WHERE `Subject` REGEXP '[1-6][0-9][0-9][0-9][0-9][0-9][0-9]';
I have attempted to use the Strip Non Digit function from here, however, the Subject line may contain other numbers that are not part of the Member ID. How can I extract just the number block that matches that regex?
I have a field called FNAME which contains the first name of an employee. For my output I want to show only the first letter of their name.
For example, if their name is "Frederic" I want it to output "F" for their first name.
How would I manipulate this to get only the first letter? Do I do it with EDTWRD in my PRTF file?
EDTWRD and EDTCDE for that matter only work on numeric fields.
You'd need to substring the value.
fname = %subst(fname:1:1);
I am doing homework for my class. I am struggling to find what is likely a simple answer. I should mention the chapter is Input Validation Loop.
I am supposed to write pseudocode for a program that will display an employee's bonus amt based on the department where he works. The program should begin by prompting the user for the EE's worker identification number (WIN) that has exactly 5 characters (which may include letters and/or digits. Then I need to use an error trap to prevent the program from continuing until the user enters a valid WIN.
The program should then prompt the user for the employee's department number. There are 15 dept numbers in this company, numbered 101 to 115. Use another error chart to prevent the program from continuing until the user enters a valid department number.
Here is what I have so far:
//Declare a variable to hold the WIN
Declare String employeeIdNo
//Prompt the user to enter WIN
Display “Please enter employee’s worker’s identification number”
Input employeeIdNo
//If necessary, adjust the number you entered
While length (employeeIdNo) = 5 Then
Display “Error! The WIN must be exactly 5 letters or digits”
Display “Please try again:”
Input employeeIdNo
End While
//Return type is a Boolean
Function Boolean _____________( )
Declare Real bonusAmt
//Get the department number
Display “Please enter the employee’s department number”
Input __________
//If necessary, adjust the number you entered
Display “Error! Please enter a valid department number “
Display “Please try again:”
Employee will earn a bonus of $____
Return bonusAmt
End Function
What I am trying to figure out is do I need to call the function in the top loop? Also, am I on the right track for displaying the dept and bonus amount in the function?
Thank you.
We are currently using Access 2003. I have a vehicle maintenance log which has a text field for vehicle numbers. The field needs to be text as it will have a R in it when a vehicle is retired. They would like to have the field be a four digit number with leading zero's. So vehicle 22 would be displayed in the table and reports as 0022 and when retired it would be R0022. I have tried to change the format of the field to "0000" and "0000"# but neither of these will display the leading zero's.
Do you really want you users to manually edit that field?
I don't like solutions like this, because it's error-prone (unless you check a lot of things to make sure that no one enters invalid data) and feels unelegant to your users.
I would just save the following in the table:
the vehicle number in a numeric field (22, not 0022)
a boolean field which indicates if the vehicle is retired
This is much easier for your users to work with:
they can just enter new vehicle numbers without having to think about leading zeros
to retire a vehicle, they just need to set a checkbox, instead of putting the right letter in front of the vehicle number
Plus, showing the desired number R0022 now becomes just a matter of displaying/formatting the data from the table:
Public Function GetDisplayNo(VehicleNo As Integer, IsRetired As Boolean) As String
GetDisplayNo = IIf(IsRetired, "R", "") & Right("0000" & VehicleNo, 4)
End Function
You can use this function like this:
GetDisplayNo(22, True) returns R0022
GetDisplayNo(22, False) returns 0022
And if you need to display a list of vehicle numbers in a report or a continuous form, you can directly use this function in the underlying query:
SELECT
Vehicles.VehicleNo,
Vehicles.IsRetired,
GetDisplayNo([VehicleNo],[IsRetired]) AS DisplayNumber
FROM Vehicles;
I'm looking for a way to identify the end position of a matched string within a string. If I have the following text in a field:
The book is on the shelf
And I want to find the ending position of the text "on", I can find the start using locate(), which returns the starting position, but I'm trying to get the ending position as well.
My expected result then would be something like this:
Text | End Position
----------------------------------------------
The book is on the shelf | 14
I have a query that uses a LIKE to find matching text with wildcards. I'm searching across a field that can contain 5000 characters of text, and of course trying to find the matching text in this field is time consuming. Therefore, I was hoping there is a way to basically show where the LIKE has matched the text. Maybe both the start and ending positions.
SELECT #a := 'The book is on the shelf',
LOCATE('on', #a) AS pos_initial,
(LOCATE('on', #a) + LENGTH('on')) as pos_final;