Splitting and joining items in a property result

Thanks for these great examples. I’ve tried to adapt it as I want to have a report based on output from dnf update command. The goal is to have a line for each missing update = multiple lines per computer.
A line with “;” separation looks like:
RHSA-2023:1841;Important/Sec.;kernel-4.18.0-372.52.1.el8_6.x86_64;2023-04-18;18:09:23`

Looking at time and date “2023-04-18;18:09:23” I would like get rid of the “;” between. Having a line like:

, ((((tuple string items 3 of it), (tuple string items 4 of it)) of concatenation ", " of substrings separated by ";" of it) of values of results (item 0 of it, elements of item 3 of it))

works pretty fine but shows as result

( 2023-05-03, 15:06:18 )

As of now I’m out of ideas how to get rid of the “,” as well as of the parantheses. I’ve tried:

  1. arrange a "concatenation " " of substrings separated by “,” around
    (tuple string items 3 of it), (tuple string items 4 of it)
  2. looked at the examples on bigfix.me. Here I’ve seen the usage example
    tuple string items (3;4)
    but I’ve not found any documentation how to have a space instead of “;”
  3. Replacing the "concatenation ", " by "concatenation " " or concatenation “%20”. This led to (fancy) empty report? Using this replacement without tuple strings around works fine.

Unfortunately, no success so far. Some help would be highly appreciated :slight_smile:

I should be able to post in much more detail later, but I think this comes down to the difference between a ‘plural result’ and a ‘tuple result’.

We separate tuple items with a comma, while we separate plurals with a semicolon. We can concatenate plural results, but when we concatenate tuple items it still results in two separate tuple items unless we’ve explicitly converted them into a plural with the use of a semicolon.

Either of these syntaxes should be a start -

(Tuple string item 3 of it & " " & tuple string item 4 of it)

Or

Concatenation " " of (tuple string item 3 of it ; tuple string item 4 of it)

(Note the semicolon rather than comma in that concatenation)

Otherwise it may be simpler to deal with the last semicolon first -

Substrings separated by ";" of (Preceding text of it & " " & following text of it) of last ";" of it

This joins the last two fields first, removing the semicolon between date & time, before then splitting the rest of the string on semicolons. So when the whole string is split, the last semicolong having already been removed, the date & time are together in one field.

(Edit - typing on my phone now, I’m unable to test at the moment, will verify the syntaxes later)

1 Like

Good morning,
thanks for the details regarding tuples and plurals as well as the suggestions.

This one works like a charm:
, (((concatenation " " of (tuple string item 3 of it ; tuple string item 4 of it) ) of concatenation ", " of substrings separated by ";" of it) of values of results (item 0 of it, elements of item 3 of it))

where this one

, (((tuple string items 3 of it & " " & tuple string items 4 of it) of concatenation ", " of substrings separated by ";" of it) of values of results (item 0 of it, elements of item 3 of it))

results in “A singular expression is required”.

Thanks very much, I will continue with the report.

For some reason it treats tuple string item X as “plural”, hence not accepting the concatenation. You can escape it by referencing each with item of - have a look at this example:

q: ((item 0 of it & " " & item 1 of it) of (tuple string items 3 of it, tuple string items 4 of it) of concatenation ", " of substrings separated by ";" of it) of "RHSA-2023:1841;Important/Sec.;kernel-4.18.0-372.52.1.el8_6.x86_64;2023-04-18;18:09:23"
A: 2023-04-18 18:09:23
T: 0.169 ms
I: plural string
1 Like

Ah, my mistake.
It’s the “items” that makes it plural, the concatenation syntax requires the singular ‘tuple string item 3’ and ‘tuple string item 4’

1 Like