Split QR Code Content based on XML like Tags

Hello together,

I have a QR code containing an XML structure like the following. Idea is to use the QR Code Scanner functionality to read this information. Part of the information enclosed in some of the tags should be extracted to other fields used in Slices.

  1. Question: Is it possible to have a field that offers QR code scanning read only? To basically just allow filling by QR code? If i make the field not editable it disappears from my view.

  2. Following structure shall be accessible and some of the content enclosed by the tags should be writted to separate fields. What kind of expression structure could I use for that? Did not find anything up to now:

<QR><DF><BT>DN</BT><BV>03</BV><D>2020-08-06</D><T>07:33:28</T><C>HOL</C><CO>DE</CO><P>D141</P><PD>Werk Hรถver</PD><N>G0050130687</N><RF>34452121</RF><DT>LS</DT><CN>0000042840</CN><CD>GP Gรผnter Papenburg AG</CD><S>0101149683</S><SD>GP/STRABAG BV A7 Allertal-Osterrie</SD><ON>34939585</ON><AN>14006610</AN><AD>CEM I 42,5 N (st) HV</AD><QT>27.920</QT><QU>TNE</QU><L1>NI-UA133</L1><L2></L2><TD>EXW</TD><CR>0001018574</CR></DF><CS><CNW>12.020</CNW><CGW>39.940</CGW></CS></QR>

For instance extract the value between <RF> and </RF>, so 34452121 is written to the field for that specific row.

Thanks a lot.

Sebastian

Solved Solved
0 4 753
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Sebastian_Henke

About this:

Yes, you may want to set a column with type Text, option Scannable, for this purpose, and another column that will make whatever you want based on it (type Ref if you want to retrieve an item in a table, or extractionโ€ฆfor example)

About that:

You may want to use a combination of various expressions, such as SPLIT() and INDEX().
Must be on another column than the scannable column, though.
For example, assuming <RF> starts your statement, and</RF> closes your statement:

INDEX(
  SPLIT(
     INDEX(SPLIT([yourQrCodeOutput]," </RF>"),1),
    "<RF>"),
     2
)

for reference:

edit : minor change

View solution in original post

4 REPLIES 4

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Sebastian_Henke

About this:

Yes, you may want to set a column with type Text, option Scannable, for this purpose, and another column that will make whatever you want based on it (type Ref if you want to retrieve an item in a table, or extractionโ€ฆfor example)

About that:

You may want to use a combination of various expressions, such as SPLIT() and INDEX().
Must be on another column than the scannable column, though.
For example, assuming <RF> starts your statement, and</RF> closes your statement:

INDEX(
  SPLIT(
     INDEX(SPLIT([yourQrCodeOutput]," </RF>"),1),
    "<RF>"),
     2
)

for reference:

edit : minor change

works like a charm! many thanks

One more thing regarding the first point, as it still does not seem to work 100% as I want:

I have the system generated form view based on a slice where the first field is the QR field to scan. This cannot be made โ€œnon-editableโ€ as its a key field and also, so theoretically the user can edit the field directly after scanning the QR, which should not be allowed. Idea would be to simply display the QR scan button and do not show the content of the QR at all in the entry form

The same accounts for the derived system Detail view which obviously is based on the same slice. Here the full content of the QR code is shown. But I cannot take it out as otherwise the QR code scanning functionality would disappear from the form view:

Do you have an idea on how to make that work? I would assume at least for the detail view maybe via a separate slice, but for system views that does not seem possible?

Thanks a lot!
Cheers,
Sebastian

Hi @Sebastian_Henke

I love your project

So, a workaround I suggest is that you may want to use a show_if condition on your scanning column:
ISNOTBLANK([columnScan])
So, itโ€™s available for scanning, but as soon as it is scanned, the field will fill up, and then it will disappear from userโ€™s eye. At doing so, it turns to be sort of not editable anymore, unless the user can type as fast as lighning. If so, the user deserves being allowed to edit

About your key_column:
You may want to use the extraction expression in the initial value field, and set it not visible but editable.
If you want to display it for any purpose, you may want to create a virtual column with expression : [yourKeyColumn], and set this one visible.

About the detail view:
you may want to use the order column option. That serves two purposes: it allows you to define which column you want to display (and soโ€ฆwhich you donโ€™t want to display), and in which order you want these to be displayed.

For reference:

and here, please have a look to the section โ€œManually ordering columnsโ€

Top Labels in this Space