Is it possible to document multiple enumeration/variables with the same documentation?
For example:
enum
{
/// Description of Values
VALUE_1 = 0,
VALUE_2 = 1,
VALUE_3 = 2
};
This results only VALUE_1 getting described by the doxygen description, when in reality, I want all three values to have the same description. The only way to get around this is copy and paste the description for every value.
You can document the whole enum instead of the individual values.
/// Description of Values
enum
{
VALUE_1 = 0,
VALUE_2 = 1,
VALUE_3 = 2
};
Member groups may be what you are looking for.
Related
A new column should be added as a function of the condition.
Match Condition
eg : ID 1877
1.) In the id group, the minimum value of tho_cw_diff should be checked and Rail position of thor_pos/CW_pos should be same.
eg : ID 7931
2.) If the rail position is not the same for the minimum tho_cw_diff value, check for the other minimum value in group ID that the rail position thor_pos/CW_po is the same.
eg: ID 8880
3.) If all the rail position is different for the group ID, select the minimum tho_cw_diff value.
According to these three conditions, the new column must be updated.
Sharing screenshot data of the expected outputs below
You can try this one.
VAR ID = [ID]
VAR CV_POS = [CV_POS]
VAR tmpTbl =
CALCULATETABLE(
tbl
,ALL()
,tbl[ID] = ID
,tbl[THO_position] = CV_POS
,tbl[CV_POS] = CV_POS
)
VAR Result =
IF(
ISEMPTY(tmpTbl)
,MIN(tbl[THO_CV_DIFF]) -- may be you can write just [THO_CV_DIFF]. I didn't check
,MINX(tmpTbl,[THO_CV_DIFF])
)
RETURN
Result
I didn't check, so come with a feedback.
By the way, you can add you table by using of following symbols: "|" and "-"
myColumn1
myColumn2
A
1
B
2
My Postgres jsonb-foo isn't that great but I'd appreciate some help with a query I am trying to put together.
I have this rudimentary query to extract the name of all keys in the _doc's 'answers' key. The jsonb data looks something like this
_doc = {
"answers": {
"baz": true,
"qux": true
"other": "How do i find this"
}
}
and a query might look this this:
SELECT ss.foo, count(DISTINCT (ss.bar)) FROM (
SELECT (_doc::jsonb -> 'bar')::text as bar,
jsonb_object_keys(_doc::jsonb -> 'answers' -> 'foo') as foo
FROM public."table_name"
) ss
WHERE ss.foo IS NOT NULL
GROUP BY ss.foo;
So really the output here would be the number of times each key of answers appears.
("baz" = 1, "qux" = 1, "other" = 1)
Here is my problem, I want to get the number of times each key appears, apart from in the case of other. In that case I want to get the number of times its contents appears. So I want the result to be
("baz" = 1, "qux" = 1, "How do i find this" = 1)
If possible I would love some help structuring this query.
Thank you
demo:db<>fiddle for several json records
demo:db<>fiddle for one json records which has the same key twice (strictly not recommended!)
Using the json_each_text() function to get the key/value pairs. After that take the keys or the value of other, selecting through a CASE clause
SELECT
CASE WHEN elems.key = 'other' THEN elems.value
ELSE elems.key
END AS key,
COUNT(*)
FROM data,
json_each_text(jsondata -> 'answers') AS elems
GROUP BY 1
I have below json string in my table column which is of type jsonb,
{
"abc": 1,
"def": 2
}
i want to remove the "abc" key from it and insert "mno" with some default value. i followed the below approcach for it.
UPDATE books SET books_desc = books_desc - 'abc';
UPDATE books SET books_desc = jsonb_set(books_desc, '{mno}', '5');
and it works.
Now i have another table with json as below,
{
"a": {
"abc": 1,
"def": 2
},
"b": {
"abc": 1,
"def": 2
}
}
Even in this json, i want to do the same thing. take out "abc" and introduce "mno" with some default value. Please help me to achieve this.
The keys "a" and "b" are dynamic and can change. But the values for "a" and "b" will always have same keys but values may change.
I need a generic logic.
Requirement 2:
abc:true should get converted to xyz:1.
abc:false should get converted to xyz:0.
demo:db<>fiddle
Because of a possible variety of your JSON keys it might be complicated to generate a common query. This is because you need to give the path within the json_set() function. But without actual values it would be hard.
A simple work-around is using the regexp_replace() function on the text representation of the JSON string to replace the relevant objects.
UPDATE my_table
SET my_data =
regexp_replace(my_data::text, '"abc"\s*:\s*\d+', '"mno":5', 'g')::jsonb
For added requirement 2:
I wrote the below query based on already given solution:
UPDATE books
SET book_info =
regexp_replace(book_info::text, '"abc"\s*:\s*true', '"xyz":1', 'g')::jsonb;
UPDATE books
SET book_info =
regexp_replace(book_info::text, '"abc"\s*:\s*false', '"xyz":0', 'g')::jsonb;
My report returns a default of;
"My cat is Fat and Lazy"
Field_1 Field_2
======== ========
1 Sleek
2 Athletic
However I want to replace 'Fat' with 'Sleek' and 'Lazy' with 'Athletic'
So the final string will read ;
"My cat is Sleek and Athletic"
My question is this, can I make the report pick up (via a formula) that if Field_1 = 1 to replace Fat with 'Sleek'?
Field_1 is static but Field_2 is dynamic and the values will change on depending on the data.
Depending on how you're pulling the data you could do this in a couple of ways:
In the SQL add a CASE statement:
CASE WHEN field_1 = 1 THEN 'sleek' ELSE field_2 END AS modified_field_2
In a formula field (Crystal syntax used in example):
if { table_name.field_1 } = 1 then 'sleek' else { table_name.field_2 }
Edit:
Please see the following link for an example of how to join a table to itself (a self-join) in order to "link" the two records to get the full sentence: http://sqlfiddle.com/#!2/59566/16
I have an array containing all string values. Contents of the array are order_id, waypoint_x, waypoint_y. How do I sort it based on order_id and have the results like 1, 2, 3, 4.... (i.e. as if the field was an integer type and string)
When I use the waypoints as the array is at the moment the results come out 1, 10, 11, 12...
Regards,
Stephen
If you check the documentation of NSArray, you'll see there are different methods for sorting the array: sortedArrayUsingFunction, sortedArrayUsingSelector, sortedArrayUsingComparator, etc.
There's a nice example of how to use sortedArrayUsingFunction to sort with integer values in the answer to this question: Sorting an array of doubles or CLLocationDistance values on the iPhone