Converter - substr - error(?)


#1

Hi

I am trying to parse a 2 character string that is entered in a Text Input asset and populate (among other things) a Simple Text asset.

As an example, if I enter “AB” and:

  1. I reference Index 1st as 1 and Last as 1, it works fine (displays “A”).

  2. I reference Index 1st as 1 and Last as 2, it works fine (displays “AB”).

  3. I reference Index 1st as 2 and Last as 1, nothing displays!

I have tried all kinds permutations of the index. Is this a known bug?

Thanks!


#2

Hi @dbj,

If the objective is to get only the 2nd character, did you try to enter 2 and 2 as 1st and last index ?

The 2nd parameter is an index, not a length.


#3

Sebastien

Understood that INDEX OF LAST CHAR actually refers to the index from beginning of string, not length. I set up 2 text elements that I successfully populated with A and B, respectively, from the source text input element, as noted in your reply.

However, my ultimate goal is to use either the original text input element OR the 2 simple text elements as the basis for 2 Excel asset interface filters, as follows:

ASSET A
ASSET B (duplicated from A, so it points back to the same physical Excel file)

GROUP A, based on ASSET A
GROUP B, based on ASSET B

OPTION 1 (does not work)
I have an “enter key is pressed” trigger on the original text input element (INPUTX), as follows:

  • filter ASSET A with a binding reference to substr of INPUTX, 1, 1
  • filter ASSET B with a binding reference to substr of INPUTX, 2, 2

Nothing is displayed in either GROUP A or GROUP B elements.

OPTION 2 (almost works)
I modified the “enter key is pressed” trigger on the original text input element (INPUTX), as follows:

  • update SIMPLE TEXT A as substr of INPUTX, 1, 1 (works fine)
  • update SIMPLE TEXT B as substr of INPUTX, 2, 2 (now works fine!)
  • filter ASSET A with a binding reference to SIMPLE TEXT A
  • filter ASSET B with a binding reference to SIMPLE TEXT B

Both GROUP A and GROUP B display the same data row. Since the ASSET B filter fires last, the row is equal to the value in SIMPLE TEXT B. I assume this is because only one filter can be applied to the same underlying Excel file / worksheet.

WORKAROUNDS
I’ve tried the following, but none of these work:

Copy the source worksheet in ASSET A and give it a unique name. IF does not recognize this, as I think it creates the internal asset map at the time the original asset is created.

Create a duplicate Excel file (from my original source outside of IF), then add it as a completely new interface asset. This also does not work:

  • I got an error msg the first time I tried to add the 2nd Excel file as an interface asset. It showed up in the list of interface assets, but I couldn’t use it.
  • I deleted the interface asset and re-added it, but now, when I try to use it in a binding, all I get is the asset header (i.e. name, # rows), not the actual columns.

OTHER NOTES
My source Excel files are large - 100K rows. It’s a list of all Chinese characters…;>(

QUESTIONS
Based on the error I got when I tried adding another Excel file - possibly a corrupted IF file?

Although the filters refer to 2 distinct interface asset names and IF automatically creates unique names at the collection, group and element levels, the names in the column list for the filters are NOT unique, as they are derived from the underlying Excel file column names - is this the problem?

Could you pls confirm whether what I am trying to do is even possible. I need to display 2 Chinese characters side by side, with their pronunciation and definitions (both derived from the Excel file).

Many thanks!

Brooks


#4

Hi @dbj,

To achieve your scenario, I think you need to

  • duplicate the sheet in your Excel file to have 2 sheets with the same content
  • apply 1 filter on sheet A, another filter on sheet B and display the result side by side

Thanks for reporting this issue / scenario, it’s true that even if you duplicate the sheet in Interface Asset panel, 1 filter will be applied on “both” data sources since in reality, there’s only 1 data source behind: the unique sheet you have at the moment.

Seb


#5

Sebastien,

Thanks for your quick reply. I previously tried your recommendation:

  1. If I open the spreadsheet from within IF, it doesn’t seem to be recognized.

  2. If I copy the spreadsheet outside of IF, the binding window only shows the header info (e.g. number of rows), not the columns.

Pls note that my excel tables contain 100K+ rows…

Cheers

Brooks


#6

This looks more like a support topic than a community thread. You should share the project with the team so they can have a look at it.

Regarding the size of the Excel file, it could be an issue. The step above is to create your own Interface Asset that would load your data (XML format?) and handle the filtering / comparison scenario.

Seb


#7

Transferred to Support Topic - INTERFACE ASSETS - 2 COLLECTIONS ACCESSING SAME EXCEL FILE