Please see a screen shot of my data:
Basically I would like to transform this concatenated resulting string sometextmoretext0.544728.822222222244728.823611111144728.825othertext (found in cell H6 in example) into whatever this data's numerical equivalent would be. However I can't seem to find a function to do this yet.
If anyone wants to know why:
I would like to make a unique ID column that is based on the unique combination of those columns. I figure all data has some kind of numerical equivalent to a computer, so there is likely to be a way!
Perhaps Apps Script can handle a task like this?
To convert each character of a string into an unicode number and concat them:
=JOIN(" ",ArrayFormula(CODE(SPLIT(REGEXREPLACE(H6,"(.)","$1♦"),"♦"))))
The formula work as follows:
Insert a special character ♦ between each characters of the original string
REGEXREPLACE(H6,"(.)","$1♦")
Split the generated string by the special character ♦, in order to get the array of the characters
SPLIT(...,"♦")
Convert each character into an unicode number
ArrayFormula(CODE(...))
Concat each unicode number with the specified string
JOIN(" ",...)
Related
I have a field, "ID" that is formatted as ###""-""##. For example 545R-T67. I have another field "Name" in the same table that pulls the information before the dash and creates it into its own field.
Right now the field is calculated to pull the first four characters Left([ID],4) the Data edition requires the data to be formatted to include data with two letters after the three numbers.
I am wondering how I can update the field to pull all characters before the dash instead of just a set amount. Is there a function in Access that makes this possible?
You can combine LEFT with INSTR to do this. INSTR returns the position of the character you're looking for (the dash).
Left([ID],INSTR([ID], "-"))
Note this will return everything before the first dash, but will return a zero-length string if there's no dash at all.
We have a field in a query that should be left-padded with zeroes if it is too short, and we accomplish this using the Format() function. However, there are some values that produce bizarre results.
Format("14425112-8","00000000-00")
Returns the value "00019330-78"
For most inputs, the string gets formatted as expected, 8 digits, hyphen, two digits. But in a few rare cases, the value is modified. Is this repeatable for anyone else? Does anyone have an explanation?
Thanks for your help.
This is an example of access trying to be too helpful. It looks like it is interpreting these values as dates, but since you didn't use any date indicators in the format e.g: (dd,mm,yyyy), it converted 1-1 to a date, and then tried to display it in decimal form:
debug.print Format("1-1","000000-00")
returns 000427-36 which is the decimal value 42736 which, if you convert to a date, becomes 1/1/2017. This is what access interpreted "1-1" as.
it seems that access has reserved the - character as symbolizing a date format, despite what their website says. This function is only useful for formatting actual dates, or numeric values, such as prices. If you are set on using the format function, you will have to change you separator to a decimal point, which apparently is the only character that will get you what you want with the leading and trailing zeros.
Otherwise, you may have to build your own function for this.
You cannot format a string like a number this way. Try this:
PaddedNumber = Right(String(8, "0") & "14425112-8", 10)
I'm attempting to query our MSSQL database but I'm getting no data when there clearly is data there.
First I query
SELECT id, instruction_link FROM work_instructions WHERE instruction_link LIKE "%\\\\cots-sbs%";
Which returns 100+ lines.
http://tinypic.com/r/ief8td/8
(sorry couldn't post as actual picture, don't have enough rep :(
However if I query
SELECT id, instruction_link FROM work_instructions WHERE instruction_link LIKE "%\\\\cots-sbs\\%";
http://tinypic.com/r/33ksw3q/8
I get no results with the 2nd query. I have no idea what I'm doing wrong here. Seems pretty simple but I can't make any sense of it..
Thanks in advance.
As documented under LIKE:
Note
Because MySQL uses C escape syntax in strings (for example, “\n” to represent a newline character), you must double any “\” that you use in LIKE strings. For example, to search for “\n”, specify it as “\\n”. To search for “\”, specify it as “\\\\”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against.
\\% is parsed as a string containing a literal backslash followed by a percentage character, which is then interpreted as a pattern containing only a literal percentage sign.
In db I have strings like so
324/23/235 -> all numbers and slashes
and
fsg/23/234 -> NOT all numbers and slashes
Now when I am in desgin view currently the criteria for this column is
>"0"
how can I also add to Find just the strings that have all numbers and slashes?
In Design View, I used this as the criteria for my text column.
Not Like "*[!0-9/]*"
Switching from Design to SQL View displayed this statement.
SELECT tblFoo.some_text
FROM tblFoo
WHERE (((tblFoo.some_text) Not Like "*[!0-9/]*"));
To understand that Like pattern, first consider this one ...
"*[0-9]*"
That matches any single character which is included in the character range 0 through 9. To match either those digits or a slash, include a slash in the range pattern ...
"*[0-9/]*"
However, those are not the characters you're concerned with. You want to target characters other than those included in the range. So you can "negate" the range by using ! in the first position.
"*[!0-9/]*"
So then Like "*[!0-9/]*" would give you rows whose text field string values contain any character other than 0 thru 9 or /. But you want the opposite --- those which do not contain any other character --- so include Not to make the final criteria Not Like "*[!0-9/]*"
The Replace function will remove the slashes and replace with and empty space. IsNumeric will return a Boolean = True if the remaining characters can be converted successfully to an number.
Select * from [TableWithStrings] as t
where IsNumeric(Replace(t.[FieldWithTheseStrings], "/", ""))=True;
These functions could be used in code as well as your view.
I'm using a field in a table to hold information about varios checkboxes (60).
The field is parsed to a string to something like this
"0,0,0,1,0,1,0,1,..."
Now I want to make a search using a similar string to match the fields. I.e.
"?,?,1,?,?,1,..."
where the "?" means that it must be 0 or 1 (doesn't matter), but the "1" must match.
As i've seen the '%' is somewhat innapropriate for this case, don't?
Obviosly both strings have the same lenght.
Suggestions?
You can use the underscore (_) character to match a single character in the mask.
Taken from MySQL documentation.