What types of files can CLIPS open - file-io

I am working on developing an expert system using CLIPS. For the case at hand I need to read data from a excel file. How do I do that? Or what solutions do you propose? Thank you in advance.

You can use the open command to open a file for reading in either text or binary mode. If you opened a xlsx file in binary mode, you could use the get-char function to retrieve individual characters from the file. There's no built-in functionality for parsing a xlsx file, so you'd have to add code to do the parsing and create appropriate CLIPS values from the data. If possible, it would be easier to save your excel file as tab-delimited text. If each cell is a valid CLIPS token, then you can use the read function to retrieve the cell values. If each cell is not a valid CLIPS token (for example, a cell representing a string that has spaces but lacks quotation marks at the beginning and end), then you need to use the readline function to grab an entire row of data and then use some of the string functions to locate the tabs and split the string into valid tokens.

Related

Search for Multiple Strings in PDF and Word, Return Page Number(s) Where Strings Appear - Power Automate

I have a list of strings (e.g. "A3.11.2.3", "A3.2.1" and "A12.1.3(b)") and need to find a streamlined way to extract the page number(s) on which each sting appears from PDF and Word files.
The list of strings is fixed/can be hardcoded though it would be better if they were read from a particular excel file. The Flow I am trying to create is:
When a file is created;
Search file for list of strings and return all page numbers on which
strings appear with each page number separated by a comma;
Populate a Microsft Word template with each string's page numbers
(i.e. a template table will be created with one string on each
row and in the column beside the page numbers will be populated).
Items 1 and 3 are easy, item 2 has been destroying my brain for how to implement.
The files to be searched are most often PDFs (always file created/no need to add OCR) but occasionally include word documents.
All ideas welcome!

Get upercase within String Value

I am currently working on a tool to automatically send out emails.
Within this tool one variable is the pathway in which the attachment is to be found.
The file names are automatically generated within a folder, but sometimes got strange symbols and/or uppercase letters, like this: "Sⁿkwrld.xlsx".
By collecting this value within a string, VBA retrieves: "Snkwrld.xlsx". This results in not being able to find the right file.
Is there a way to fix this problem and let VBA retrieve the correct value with the uppercase "N"?
Thanks in advance!
Best Regards,
Remco Coppens

Converting a bunch XLSX files in a folder into CSV

the catch is that the xlsx files have some Korean text which on converting to csv is changing to "??"
First convert the contents of xlsx file from Korean to English as shown in below link:
https://www.microsoft.com/en-us/translator/excel.aspx
Then proceed to convert xlsx to csv.
You might consider simply coding a loop saving as Unicode Text (*.txt) file format, and then changing the file extension to .csv
UTF-16 is useful if your Excel data contains any Asian characters e.g. Korean.
Note:
It is not fully compatible with ASCII files and requires some Unicode-aware programs to display this so be careful if exporting outside of Excel.
Information on options are discussed here
To continue quoting from there:
How to convert an Excel file to CSV UTF-16 Exporting an Excel file as
CSV UTF-16 is much quicker and easier than converting to UTF-8. This
is because Excel automatically employs the UTF-16 format when saving a
file as Unicode (.txt).
So, what you do is simply click File > Save As in Excel, select the
Unicode Text (*.txt) file format, and then change the file extension
to .csv in Windows Explorer. Done!
If you need a comma-separated or semicolon-separated CSV file, replace
all tabs with commas or semicolons, respectively, in a Notepad or any
other text editor of your choosing (see Step 6 above for full
details).
Every text file has a character encoding for a character set. You have to pick one.
If you pick one that doesn't support all the characters in the file, what would you like to happen? Replacing with ? is a commonly used option.
Picking UTF-8 for Unicode is a good choice for an Excel workbook (and almost all documents) because it uses the Unicode character set (as does VBA, BTW).
In any case, for a text file you have to communicate which encoding you use; And, for a CSV text file, whether there is a header row, what the field separator is, what the text qualifier is (quoting), text qualifier escape, line separator line characters, and column types are. (All of these are questions the Excel's text import wizard asks. Your users need the answers.)

Finding occuramce of a string in a column in excel based text file

I am using vb.net to find the sum of occuramce of string in a particular column in text file(excel based) . The text file is not tab delimited, and it is separated column by column nicely, I only learnt how to read line by line using stream reader but I have no idea how to read only the last column of the line and summing up the specific string that I want. Any idea how to do it? Not nesseccary nid to provide me the code
If by "an Excel-based text file" you mean that the values are comma-separated, you can read it in line by line, like you already are doing using a stream, and then use Split to separate the line out into an array. Google "vb.net split" to learn how to do this.

Excel reads "64E0113" style codes as a number "6.4E+114" even when formatted as text

When reading a csv file containing ID numbers, excel is reading strings as numbers. This also occurs when reading the same style of ID's in an excel vba array.
Under locals, the elements of the array are displayed as datatype "String", but the format is still a number.
I have tried changing the style to text as well as using CStr() on individual elements of an array. Is there a way to have excel read the ID's as a string instead of a number?
Thanks.
You need to bypass the automatic conversion when you open the .csv file.
Use the Import Wizard to open the file and tell the Wizard that the field is text.
To convert back this might suit:
=SUBSTITUTE(LEFT(A1,3),".","")&"E"&TEXT(RIGHT(A1,3)-1,"0000")