Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code function to concatenate and manipulate strings #51

Open
noamoss opened this issue Oct 16, 2019 · 5 comments
Open

code function to concatenate and manipulate strings #51

noamoss opened this issue Oct 16, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request question Further information is requested
Projects

Comments

@noamoss
Copy link
Contributor

noamoss commented Oct 16, 2019

The follwoing functions are example for a common need: manipulating strings (either from report record or user input) and to concatenate them into a single string, to be stored ina a report variable:

  • combinedPoliceEventDescription,
  • combinedEventDescription
  • addMunicipalReaction

Since this is a returning need, as the current code tells us, and since the static texts added in the code level are not being translated (right?) I wondered if we should replace them with a function (cmd) to be called from the yaml/json script.

sunch function will have two parameters:

  • list of strings: to combine into a single string
  • the name of the record field in which we will save it.

note: building this function worth the efforts only if it enables to to combine field current text with a combination of a temporary variable and other static texts, like this:

new_description += `\n עדים או אנשים שיוכלו לאמת את הפרטים: \n${record._witness_details}`;
```
@noamoss noamoss added enhancement New feature or request question Further information is requested labels Oct 16, 2019
@noamoss noamoss added this to To do in Report-it via automation Oct 16, 2019
@akariv
Copy link
Member

akariv commented Oct 17, 2019

Yes, you could have a format function e.g.:

- do:
    cmd: format
    params:
    - record
    - target_field
    - format_string

Where format string would be able to use values from the record, e.g.
{{field1}}, {{field2}} and {{field3}}
or
- :field1\n- :field2\n- :field3

One note about the implementation though - I noticed that currently it always appends to the record, regardless of whether there already was a summary attached to it, creating very long values of repeated information.

Perhaps you could auto-add a separator (e.g. \n~~~~\n) which you'll use to mark the start of the automatic data, and when adding new data first delete whatever is after it before adding the new summary.

@noamoss
Copy link
Contributor Author

noamoss commented Oct 17, 2019

Perhaps you could auto-add a separator (e.g. \n~~~~\n) which you'll use to mark the start of the automatic data, and when adding new data first delete whatever is after it before adding the new summary.

sounds good.

What is your time estimation for this task?

@akariv
Copy link
Member

akariv commented Oct 17, 2019 via email

@noamoss
Copy link
Contributor Author

noamoss commented Oct 17, 2019

great, I think we should do it, as it is also a planned feature of the script editor (cc @oferb).

@noamoss
Copy link
Contributor Author

noamoss commented Oct 20, 2019

please consider #52 when handling this issue.

@noamoss noamoss moved this from Prioritized to To do in Report-it Feb 17, 2020
@noamoss noamoss moved this from To do to Prioritized in Report-it Feb 17, 2020
@noamoss noamoss moved this from Prioritized to To do in Report-it Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
Report-it
  
To do
Development

No branches or pull requests

2 participants