Why is the comment cid not being replaced with tokens? - drupal-7

On admin/structure/trigger/comment I have the following:
On admin/config/system/actions I have the following:
When I click "configure" and go to admin/config/system/actions/configure/81
Here's the text in the message textarea:
[comment:url:absolute]
Comment ID: [comment:cid]
Comment Text:
[comment:body]
Comment Author:
[comment:author]
Comment Created:
[comment:created]
This is the email I receive, notice how it is not replacing comment:cid:
https://example.com/comment/#comment-
Comment ID:
Comment Text:
This is a test comment.
Comment Author:
auser
Comment Created:
February 5, 2015 - 21:20

Related

Combining LEFT, SEARCH and REGEXREPLACE

So, I'm helping out someone, and I'm trying to extract only the name of the cancer in the column, without including "Deaths -".
In Column A, the entries all have this pattern, each string below being in it's own separate row...
Deaths - Prostate cancer - Sex: Both - Age: Age-standardized (Rate)
Deaths - Breast cancer - Sex: Both - Age: Age-standardized (Rate)
Deaths - Testicular cancer - Sex: Both - Age: Age-standardized (Rate)
Deaths - Non-melanoma cancer - Sex: Both - Age: Age-standardized (Rate)
Deaths - Tracheal, bronchus, and lung cancer - Sex: Both - Age: Age-standardized (Rate)
I've been able to extract the name of the cancer, including removing the word "cancer" with this LEFT and SEARCH formula below...
=LEFT(A2, SEARCH("cancer", A2)-1)
Resulting in the following...
Deaths - Breast
Deaths - Testicular
Deaths - Non-melanoma
Deaths - Tracheal, bronchus, and lung
But, I can't seem to combine REGEXREPLACE with LEFT and SEARCH in one formula to also take out "Deaths" and the - (dash), leaving only the name of the cancer.
So, the desired result is below...
Breast
Testicular
Non-melanoma
Tracheal, bronchus, and lung
Thanks for any help you can provide.
try simple:
=INDEX(IFNA(REGEXEXTRACT(A1:A6, "- (.+) cancer")))

Conditionally add properties to elements of array with yq (version 4)

I have a YAML document that contains an array. I would like to conditionally add properties to the elements of that array using yq version 4 from mikefarah.
Here is a sample YAML document.
name: "My Pets"
pets:
- name: "cat"
age: 8
- name: "dog"
age: 3
- name: "mouse"
age: 1
I would like to transform this into,
name: "My Pets"
pets:
- name: "cat"
age: 8
shots: cat.upToDate
- name: "dog"
age: 3
shots: dog.upToDate
- name: "mouse"
age: 1
shots: mouse.upToDate
where we add a shots property to each element of pets. The value of shots should be whatever the name value is, dot, upToDate.
I'm trying something like this,
yq eval '.pets[] | select(.name == "cat").shots = "cat.upToDate"' test.yaml
but that produces,
name: "cat"
age: 8
shots: cat.upToDate
name: "dog"
age: 3
name: "mouse"
age: 1
I need to preserve the entire original YAML document and just insert the shots property.
This is close but missing all of the other pets.
yq eval '.pets = (.pets[] | select(.name == "cat").shots = "cats.upToDate")' test.yaml
It produces,
name: "My Pets"
pets:
name: "cat"
age: 8
shots: cats.upToDate
I'm thinking maybe we could store the name of the pet in a variable and reference that later, but v4 is brand new to me today.
I would prefer to have a one-liner so that I don't have to filter on .name. This array has less than 10 elements so I could easily hard-code the name and call yq 10 times.
Any thoughts or suggestions? Many thanks, Weldon
Use |=, e.g. like so:
yq eval '.pets[] |= (.shots = (.name + ".upToDate"))' pets.yaml

How to validate one field against another with Yup?

I'm setting up a form with two fields; start month and end month.
Start month and end month are just represented by integers (0-11) for the corresponding months. I need validation to ensure that end month comes after start month (ie the integer for end month is bigger).
I've looked at other similar issues from a few years back, but yup seems to have updated to render them useless. I've tried the below code with a few variations.
I am also having difficulty validating end month as a number (.number() - I'm assuming I have to maybe to do this within the test function.
let schema = yup.object().shape({
startMonth: yup
.number()
.required()
.positive()
.integer(),
endMonth: Yup.string().test(
"End Month Validation",
"error message",
value => {
return value > startMonth;
}
)
.number()
.required()
.positive()
.integer(),
});
Errors:
Line 102: 'startMonth' is not defined no-undef
Another approach would be to make use of .ref() and .moreThan() to perform this validation logic.
Something like the following should achieve what you require:
let schema = Yup.object().shape({
startMonth: Yup
.number()
.required()
.positive()
.integer(),
endMonth: Yup.number() /* Remove .string() */
.required()
.positive()
/* Reference startMonth field in validating endMonth value */
.moreThan(Yup.ref('startMonth'), "End month must come after start month")
.integer(),
});
schema.validate({ startMonth : 1, endMonth : 2 }) // Okay!
schema.validate({ startMonth : 11, endMonth : 2 }) // Throws exception
Hope that helps!

failed to execute 'put' on 'idbobjectstore' evaluating the object store's key path did not yield a value

A chrome based APP which I am supporting gives us this error.
I tried to find out more about the error but was unsuccessful.
Can someone kindly explain me on what could be the cause of this.
The Error is as below Image
The put is happening at this snippet
var ydbRequest = ydbStorage.put(dbName, data);
The dbName: OUTLETS
and the data value is:
1. Action: "Submit"
2. ChannelGroup: "ZC03"
3. City: "LA"
4. CreateDate: Fri Jun 24 2016 10:23:03 GMT-0400 (Eastern Daylight Time)
5. MUValue: Object
6. ModifiedDate: Mon Jun 27 2016 11:16:24 GMT-0400 (Eastern Daylight Time)
7. Mu: "U39 "
8. Name: "54321"
9. OutletId: "0000054321"
10. OutletImage: ""
11. Promotion: Object
12. SignatureImage: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABLCAYAAABeMdGUAAAFTElEQVR4Xu3azcttUxwH8O8l8pKSDMxIUTJQTEwUiZmZlBEzMyV/gPwBUmZGzJTMzIjIxMTgDqSUGBpISl7y3qqz6/Y4z3nOWXc/Z+3ffj6n7uTe/dvrtz5r3f1tv1yKHwECBAgQ6BC41FGjhAABAgQIRIDYBAQIECDQJSBAutgUESBAgIAAsQcIECBAoEtAgHSxKSJAgAABAWIPECBAgECXgADpYlNEgAABAgLEHiBAgACBLgEB0sWmiAABAgQEiD1AgAABAl0CAqSLTREBAgQICBB7gAABAgS6BARIF5siAgQIEBAg9gABAgQIdAkIkC42RQQIECAgQOwBAgQIEOgSECBdbIoIECBAQIDYAwQIECDQJSBAutgUESBAgIAAsQcIECBAoEtAgHSxKSJAgAABAWIPECBAgECXgADpYlNEgAABAgLEHiBAgACBLgEB0sWmiAABAgQEiD1AgAABAl0CAqSLTREBAgQICBB7gMC6BN5K8mmSt9c1LbNZooAAWeKq6IlAv8C3SR5L8l3/KVQS2E9AgOzn5CgCFQTu3Nx93FWhWT3WFxAg9dfQDAhMAs9t7j6eR0LgGAIC5BjKxiBwHAHvP47jbJSNgACxFQisR8D7j/WsZYmZCJASy6RJAmc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EABATIQ39AECBCoLCBAKq+e3gkQIDBQQIAMxDc0AQIEKgsIkMqrp3cCBAgMFBAgA/ENTYAAgcoCAqTy6umdAAECAwX+AwgEXkzfHpKFAAAAAElFTkSuQmCC"
13. State: "NV"
14. Status: "Signed"
15. Street: "11 ABC"
16. TargetCMAID: "54AAFF2ECAFF4410E1008000A7692971"
17. Year: 2015
18. ZipCode: "89201"
19. _disabledStates: Object
20. _displayOrderLimit: Object
21. _recallState: "fsop.outlet.review-sign.summary"
22. _validationStates: Object
23. __proto__: Object
Let me know in case I need to add more details.
TIA
If your object store has a key path, the object being stored must contain a value pointed at by that key path or must use a key generator ({autoIncrement: true}).
For example:
var store = db.createObjectStore('my_store', {keyPath: 'key'});
store.put({key: 11, value: 33}); // OK
store.put({value: 66}); // throws, since 'key' is not present
var store = db.createObjectStore('my_store', {keyPath: 'key', autoIncrement: true});
store.put({key: 11, value: 33}); // OK, key generator set to 11
store.put({value: 66}); // OK, will have auto-generated key 12

Printing the records one below the other

I want to print data like this :
FirstName FamilyName (33 characters), Tel: xxxxxxxxxx, Age: xx, Level: xx, Salary: xxxxx.xx
For example
John Dilbert Tel: 6135202600, Age: 58, Level: 13, Salary: 450.34
Jane Smith Tel: 6135202600, Age: 47, Level: 10, Salary: 133450.00
Main problem am facing is how to put Tel: one before the other . Also how to format the floating salary such that decimal comes one below the other.
Currently my output look like this :
John Dilbert Tel: 6135202600, Age: 58, Level: 13, Salary: 450.34
Jane Smith Tel: 6135202600, Age: 47, Level: 10, Salary: 133450.00
Code :
void printData(struct person currentPerson){
printf("%s %-33sTel: %10s",currentPerson.firstName,currentPerson.familyName,currentPerson.telephone);
}
void printStudent(struct Student currentStudent){
printf("GPA:%3d, Courses:%3d, Tuition: %5f\n",currentStudent.GPA,currentStudent.coursesCount,currentStudent.tuitionFees);
}
In main:
printData(person[i]);
printf(", ");
printStudent(person[i].student);
But still result is wrong. Why ? Please help
If you want to control the width of your data, then you could use the width sub-specifiers in the printf format string. Eg. :
printf("%5d", 2);

Resources