Solved Notepad

Status
Not open for further replies.

gayatri

New Member
In notepad we have text like

what color?:red
what chocolate?:dairy milk
do you like icecreams?:yes

we have to get each question in one dataitem.
But i am getting first question but after it how we can get next question in blueprsim.
 
Use the utility - File Management > Read all text from file . That way you get all the text file into a data item. Then use utility strings > split lines. That way you get each line of the file as a row in a collection. You later can check each data item of the collection representing each a line of the text.
Hope this helps.
Andres.
 

gayatri

New Member
Thankyou for your reply sir,
I am using split lines by length but the output is
what color?:
red what chocolate?:
dairymilk
each is coming in one row.Any another alternative i can have.
 
if you pass the text in to a collection, check the collection and see if the are more than one column maybe the ":" makes split the line in more than one column . I suggest to use split lines not by length too
 

VJR

Well-Known Member
Hi gayatri,

See if this works out for you.

1.jpg: Shows how the overall Process Diagram looks like
2.jpg: 'Read All Text File' will get the contents of Notepad into the 'TextFromNotepad' data item
3.jpg: Split Lines on 'TextFromNotepad' and generate the 'Split Values' output collection
4.jpg: Add a new column called as 'Question' to the collection where all your questions will be stored.
Similarly add another stage to add the 'Answer' column (in case you need it :)).
- Then loop on the 'Split Values' collection
5.jpg: Then add a Multi Calc stage to separate out the Question and Answer from the Original value.
This is how they look if you are not able to see in the screenshot

Left([Split Values.Value], InStr([Split Values.Value], "?:")-1)
Right([Split Values.Value], Len([Split Values.Value])-InStr([Split Values.Value], "?:")-1)

If you have Leading and Trailing spaces in your question or answer then you can use the Trim function too.
6.jpg: This is how the Output of the Split Value collection will look like after running the process

6. Output collection.JPG
 

Attachments

  • 1. Process Diagram.JPG
    1. Process Diagram.JPG
    31.7 KB · Views: 56
  • 2. Read All Text File.JPG
    2. Read All Text File.JPG
    32.9 KB · Views: 59
  • 3. Split Text on the data item.JPG
    3. Split Text on the data item.JPG
    25.5 KB · Views: 53
  • 4. Add Question column.JPG
    4. Add Question column.JPG
    32.1 KB · Views: 83
  • 5. Multi Calc stage to separate qs and ans.JPG
    5. Multi Calc stage to separate qs and ans.JPG
    34.4 KB · Views: 50

gayatri

New Member
Thankyou for your reply sir,
This logic can work for even question like
Description about car I want:It should be of blue colour and nearly 10 people can accomodate in it.The mileage should be high compared to other cars.We should feel comfortable while we sit in it.

In this question we have 2 lines of data can we get this also like single line questions.
 

VJR

Well-Known Member
Hi gayatri,

If this is how the question and multi line answer looks like...
1523390125606.png

Then the output of the process will look like this..
1523390202969.png


So, it works fine as far as there is a ?: after the question and also a newline character (or enter) is not present within the multi line answer. This is because the 'Split Lines' splits the lines of the text from Notepad based on the new line character.
 
Status
Not open for further replies.
Top