Login to follow
Sentence Concatenator

Sentence Concatenator (ODC)

Stable version 0.1.1 (Compatible with ODC)
Uploaded on 04 October 2024 by Truewind
Sentence Concatenator

Sentence Concatenator (ODC)

Documentation
0.1.1

===== Available Actions =====

  • Concatenator -> Action that will do the whole process. Detailed explanation further below.
  • HasAnyOptionsSelected -> Automated action to check if any options of a topic are selected. Used to easily set "HasAnySubSelected".
  • RemoveUnselected -> Automated action to remove any unselected options from the list. Facilitates saving selected data into database.
  • ReplaceContentTopic -> Action used within "Concatenator" action to replace any "[content]" literal in "BeforeSuboptionStatement" with what is set in the "Content" input parameter of the "Concatenator" action.
  • ResetAllOptions -> Facilitator action to reset all selected options. If CurrentRowNumber is set, the mentioned row number of the list will be ignored, therefore not reset.


===== SETUP =====

  1. Install component into your environment.
  2. Consume actions and structures.
  3. Create two entities containing the following attributes:
    1. Entity 1 for the Topic_Str (You may include any other necessary attributes):
      • Id
      • Label
      • BeforeSuboptionStatement
      • AfterSuboptionStatement
      • Order
      • IsDeleted
    2. Entity 2 for the Option_Str (You may include any other necessary attributes):
      • Id
      • Label
      • AlternativeValue
      • IsNewLine
      • OptionId
      • Order
      • IsDeleted
  4. Use the structures and assign the database values into the respective fields.
  5. The options will be a list of Option_str within the list of topics.

  6. Easiest way to implement your UI Structure.

  7. Implement the logic to tick/untick the selected/unselected options in the Options list level.
    • This is how I called mine:

    • There are boolean attributes on both Topic (HasAnySubSelected) and Option (IsSelected) levels to identify whether the option was selected or not.
    • For Option_Str.IsSelected, simply call an Screen Action within your list level and assign it as not IsSelected.
    • Example:

    • In order to tick/untick Topic_Str.HasAnySubSelected, use the "HasAnySubOptionsSelected" client action and assign the value.
  8. In the send action, use the "Concatenator" client action to concatenate all the values.

===== How does this action work? =====



===== Paramenters =====

INPUT

*Topic_strList -> List of used topics in your app.

*Content -> Information to replace "[content]" in the "BeforeSuboptionStatement".


OUTPUT

*ConcatenatedPrompt -> The final result.


===== Process =====

  • It will iterate over all topics:
    • First, the action will check if HasAnySubSelected is True. If False, it will ignore the current topic's content.
    • Otherwise it will start the concatenation process:
      1. The sentence will start with whatever is set in "BeforeSuboptionStatement".
        • Note: If you have the literal "[content]" in your "BeforeSuboptionStatement" value, you can use Content input and the value "[content]" will be replaced automatically.
      2. Then, it will go through each where Option.IsSelected = True.
        • At this point, it will check two things:
          • If IsNewLine = True, an "NewLine()" will be included for line break, otherwise, a comma will be added.
      3. After its iteration of all Option.IsSelected = True happens, at the end of the sentence whatever is set in "AfterSuboptionStatement".
    • This process will repeat for all other Topic_Str where HasAnySubSelected is True.

===== Example =====


Imagine an example of topic "Professions" with the following options:


Topic_str:

- Label = "Professions"

- BeforeSuboptionStatement = "The [content] should introduce the user into the following professions:"

- AfterSuboptionStatement = "And should include examples requirements, tasks and functions about that profession."


Option_Str [1]:

- Label = "Mechanic"

- AlternativeValue = ""

- IsNewLine = True

- IsSelected = True


Option_Str [1]:

- Label = "Pilot"

- AlternativeValue = "or Helicopter Pilot"

- IsNewLine = False

- IsSelected = True


The final sentence will be:


"The [content] should introduce the user into the following professions:

Mechanic, or Helicopter Pilot.

And should include examples requirements, tasks and functions about that profession."


If *Content = "career plan", the final sentence will be:


"The career plan should introduce the user into the following professions:

Mechanic, or Helicopter Pilot.

And should include examples requirements, tasks and functions about that profession."


===== FAQ =====

  • How to I reset these selected options?
    • Use the "ResetAllOptions" client action.
  • I want to reset all, except for one specific topic. Is it possible?
    • Use the "ResetAllOptions" client action, and in CurrentRowNumber, pass the topic you want to keep it selected.
  • I want to reset all, except for more than one specific topic. Is it possible?
    • No. Currently the action will only check for one specific row. May be added in the future, if required.
  • I want to save the selected options into the database.
    • Use the "RemoveUnselected" client action facilitate your save process. This action will remove:
      • All Topics where HasAnySubSelected = False.
      • And where Topics.HasAnySubSelected = True.
        • Remove all Option.IsSelected = False.
    • Suggestion (not necessarily required, but it's the easiest way) to save the output:
      • You can JSON_Serialize the client action's output and save it into a separate entity.