Hello,
I really need your help. I have a paragraph that contains a list of items with their key and value.
Example:
Here is the list of items that we are looking for from XYZ:
Car Model: 123, Brand: YXZ, reference:908 I Car Model:567, Brand:KLH, reference:765, etc…
I would like to split each of them into a single row and under their respective column, and then push that information back in a db I created.
Thanks
Add a Text Parser module and configure it to parse the paragraph by splitting it into key-value pairs. You can use a regex like (Car Model:\s*\d+),\s*(Brand:\s*\w+),\s*(reference:\d+)
for this.
Then, format the data into CSV. Add a Create CSV (advanced) module, define a data structure with columns for “Car Model”, “Brand”, and “Reference”, and map the parsed items to these columns.
After that, insert the data into your database. Add the appropriate database module (e.g., MySQL > Insert Row) and map the CSV data to your database fields.
You can also use the split function to extract key-value pairs from the paragraph. Add a an Iterator module and configure it to split the paragraph using delimiters. For instance, you can split the text using I
as the delimiter to separate each item, and then further split each item using commas ,
to separate key-value pairs.
Welcome to the Make community!
Please provide the output bundles of the modules containing the example text by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
![Screenshot_2023-10-06_141025](https://europe1.discourse-cdn.com/business20/uploads/make/original/3X/2/8/2876156ab3ea5bc9e40bbc0edfb9f025406b7c48.png)
A.
Save each bundle contents in your text editor as a bundle.txt
file, and upload it here into this discussion thread.
Uploading them here will look like this:
module-1-output-bundle.txt (12.3 KB)
B.
If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:
-
Either add three backticks ```
before and after the code, like this:
```
input/output bundle content goes here
```
-
Or use the format code button in the editor:
![Screenshot_2023-10-02_191027](https://europe1.discourse-cdn.com/business20/uploads/make/original/3X/b/4/b485b6572c7a1c438f9b191c54e63d351008304c.png)
Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.
This will allow others to better assist you. Thanks!
samliew – request private consultation
Join the Make Fans Discord server to chat with other makers!