I'm new to COBOL and I would like to know how I could auto-generate a unique ID for every single transaction. For example, the auto-generation of a tracking ID.
UUID/GUID is an universally unique identifier, and it can be generated using COBOL intrinsic function,
Display "Unique Identifier: " FUNCTION UUID4
Output should look something like,
Unique Identifier:192caea2-a913-4f05-84d8-d62c46c3aff9
This function is supported from COBOL 6.
reference https://www.ibm.com/docs/en/cobol-zos/6.1?topic=functions-uuid4
This is not easily done for a globally unique ID, but it is not hard to simulate using the data you might have on hand at the time of the transaction, consider:
01 Unique-ID.
05 UI-Customer-Num Pic 9(?).
05 UI-Date Pic 9(8).
05 UT-Time Pic 9(7).
*>Populate with Compute UI-Random = 999999999 * Function Random()
05 UI-Random Pic 9(8).
Assuming you have a customer number, you can genereate a unique id down to the tenth of a second with data that you will possess in the transaction. Just add a large random number to the end of that and you have a unique ID.
If it is important that the tracking ID does not provide any data give back any data to the casual reader, you can take the final Unique-ID and run it through a one way hash, like SHA1, SHA2, SHA256, whatever.
Related
Does "first" mean first in this run of the app (until the app terminates and restarts), or first across runs?
I thought that these fields will have only one value, but they often have two. When I run this query:
SELECT
user_pseudo_id,
COUNT(*) AS the_count
FROM (
SELECT
DISTINCT user_pseudo_id,
user_first_touch_timestamp AS user_first_touch_timestamp
FROM
`noctacam.<my project>.events*`
WHERE
app_info.id = "<my bundle ID>"
ORDER BY
user_pseudo_id)
GROUP BY
user_pseudo_id
ORDER BY
the_count DESC
I find that 0.6% of my users have two different values for user_first_touch_timestamp. Is this a bug in Firebase?
Likewise for first_open_time:
SELECT
user_pseudo_id,
COUNT(*) AS the_count
FROM (
SELECT
DISTINCT user_pseudo_id,
user_properties.value.int_value AS first_open_time
FROM
`noctacam.<my project>.events*`,
UNNEST(user_properties) AS user_properties
WHERE
app_info.id = "<my bundle ID>"
AND user_properties.key = "first_open_time"
ORDER BY
user_pseudo_id)
GROUP BY
user_pseudo_id
ORDER BY
the_count DESC
Exactly the same 0.6% of users have two different values for this field, too.
References:
https://support.google.com/firebase/answer/7029846?hl=en
https://support.google.com/firebase/answer/6317486?hl=en
I started wondering about the difference in these 2 params too and found this difference.
From User Properties:
First Open Time - The time (in milliseconds, UTC) at which the user first opened the app, rounded up to the next hour.
From BigQuery Export Schema:
user_first_touch_timestamp - The time (in microseconds) at which the user first opened the app.
In my case, the rounding was the difference. I envision that Firebase needed to have first_open_time as a User Property for some reason so they just rounded and copied user_first_touch_timestamp.
I know it still doesn't answer your whole question and doesn't explain why 0.6% of your users have 2 different values. I still thought that this may help someone here.
There is also a difference in the description of the two parameters:
first_open = "the first time a user launches an app after installing or re-installing it"
whereas first_touch_timestamp has no mention of the value updating for re-installs. It is likely your 0.6% difference is users who have re-installed the app.
The difference is in the accuracy of the data:
while User_first_touch_timestamp gives the exact time,
First_open_time gives the rounded-up time.
Take a look at the following examples:
User 1:
User_first_touch_timestamp: 1670263710266000
Mon Dec 05 2022 20:08:30 GMT+0200
First_open_time : 1670266800000
Mon Dec 05 2022 21:00:00 GMT+0200
User 2:
User_first_touch_timestamp: 1670248060903000
Mon Dec 05 2022 15:47:40 GMT+0200
First_open_time: 1670248800000
Mon Dec 05 2022 16:00:00 GMT+0200
Here is my data:
I am trying to build a SUMIFS formula to sum the sessions, if the month = "last month" (i.e., parsed out of these strings), and the Channel Grouping = "Display".
Here's what I have so far:
=SUMIFS(H3:H,F3:F,________,G3:G,"Direct")
Since this is a string, not a date, I am not sure how to get it to match "last month".
Why not build up a string like this (or just hard-code it?)
=sumifs(H3:H,F3:F,year(today())&"|"&text(month(today())-1,"00"),G3:G,"Direct")
This builds up a string equal to "2017|03" by taking the year from today's date (2017) and one less than the month number from today's date which at time of writing is April so 4-1=3. The text function formats it with a leading zero. So the whole thing is"2017" & "|" & "03" which gives "2017|03" - this is compared against column F.
Note: January would be a special case (existing formula would give "2018|00" for previous month to January 2018 so would need a bit of extra code to cover this case and make it fully automatic).
By 'hard-code it' I mean just put 2017|03 in as a literal string like this
=sumifs(H3:H,F3:F,"2017|03",G3:G,"Direct")
then just change it manually for different months.
Here is a more general formula
=sumifs(H3:H,F3:F,year(eomonth(today(),-1))&"|"&text(month(eomonth(today(),-1)),"00"),G3:G,"Direct")
Just change the -1 to -2 etc. for different numbers of months.
EDIT
In light of #Max Makhrov's answer, this can be shortened significantly to
=sumifs(H3:H,F3:F,text(eomonth(today(),-1),"YYYY|MM"),G3:G,"Direct")
I would like to add two more options:
1
This formula is slightly shorter and more powerrful, because it gives the full control over date format:
=TEXT(TODAY(),"YYYY|MM")
formula syntax is here:
https://support.google.com/docs/answer/3094139?hl=en
2
In your case converting date to string is more efficient because it calculates one time in the formula, so there's fewer calculations. But sometimes you need to convert text into date. In this case I prefer using regular expresions:
=JOIN("/",{REGEXEXTRACT("2017|03","(\d{4})\|(\d{2})"),1})*1
How it works
REGEXEXTRACT("2017|03","(\d{4})\|(\d{2})") gives 2 separate cells output:
2017 03
{..., 1} adds 1 to ... and adds it to the right:
2017 03 1
JOIN("/", ...) joins the ... input:
2017/03/1
This looks like date, but to make it real date, multimpy it by 1:
"2017/03/1"*1 converts string that looks like date into a number 42795 which is serial number for date 2017 march 01
Capybara: How to select drop down value from below html
Month
01
02
03
04
05
06
07
08
09
10
11
12
The from option to select takes either the id, name, placeholder, or the text of an associated label element of the select element. "data-reactid" is none of those. Given the html you have put in the comments (please edit your question and add it there) you could just do
select("01") # assumes there are no other select boxes with that option on the page
or you could do
find('select[data-reactid=".0.0.1.1.2.1.$0.0.2.0.1"]').select("01")
which is just short for
find('select[data-reactid=".0.0.1.1.2.1.$0.0.2.0.1"]').find(:option, "01").select_option
Note: within '#.0.0.1.1.2.1.$0.0.2.0.1' isn't going to do anything since within takes a css selector and none of your elements have the id '#.0.0.1.1.2.1.$0.0.2.0.1' ( a data-reactid is not an id ) . On top of that the selector as written is invalid and would probably need to be within '#\.0\.0\.1\.1\.2\.1\.\$0\.0\.2\.0\.1' if an element with that id existed
I am using grails2.3.7 and i stuck here while using like .In database phone number is 02 356534653 , 02 356 534653 , (02)-(356)-(534653) while i am giving value like
02356534653. So i compare and get records.
I'm currently given three values in a table
A date value in the format of %dd-%mname-%yy (i.e 06-may-05), and am parsing that using Date.parse(input,true) to fix the issue with the leading values.
I'm then given a time value in the form of %hh:%mm:%ss.%ms (the ms of which I can take or leave) and a third value of a GMT offset.
I can't really see anyway to convert these three values into a single DateTime object that would allow me to manipulate it using the range of ruby tools without first parsing the second value to time, somehow changing the offset ((given as a + or - n value) as in +2 or -6)to a signed int and then applying it and then parsing this all to a super dateTime object.
There's got to be a better way. Is there?
Chronic may be able to parse this (if you concatenate everything in one string, maybe with some modifications) but I haven't checked.
Okay in order to create a dateTime value with the time and the date given and to take into account an offset you need the following code
d = DateTime.parse(dateVal+" "+TimeVal)
offset = Rational(offset_val,24)
d = d.new_offset(offset)
So take your date, given to you as say 05 May 2010 and a timeval in the form hh:mm:ss
With an offset of +- any value, for this instance say -8
Then this code will generate you a new date object, offset to the amount you require