IndexOf SubString

From SMTX Wiki
Jump to navigation Jump to search

Example 1: I need from ‘Long_Long (personfield)’ everything before the first ‘\’.

  So from this entry:
  SMTX\DDEVILDER
  I need:
  SMTX

I would normally do:

 SUBSTRING('#REPLACE-PERSONFIELD-RequestedFor-Login_Long#', 0, INDEXOF('#REPLACE-PERSONFIELD-RequestedFor-Login_Long#', '\'))

Bit the ‘\’ needs to be excepted (don’t ask me why-), so you need it twice:

 SUBSTRING('#REPLACE-PERSONFIELD-RequestedFor-Login_Long#', 0, INDEXOF('#REPLACE-PERSONFIELD-RequestedFor-Login_Long#', '\\'))

Example 2 : filename extraction

I need the filename of an uploaded file. It will give this normally:

  <A HREF="http://dev.ssp7.smt-x.com/Forms/UserFiles/Uploads/Temp/stf2cbxcypkywtnrmcqt2cjq.8797.richardGere2.psd" target="_blank">richardGere2.psd</A>

So we need al input after the first '>' and before the next '<'

New method:
GetXmlProperty('#REPLACE-FORMFIELD-Testuploadedfilesattachmentemail||Upload1FileForm||#', '/A/text()')

Old Method: Substring('#REPLACE-FORMFIELD-testfilenameextraction||Upload01||#',LastIndexOf('#REPLACE-FORMFIELD-testfilenameextraction||Upload01||#','">')+2,LastIndexOf('#REPLACE-FORMFIELD-testfilenameextraction||Upload01||#','<')-LastIndexOf('#REPLACE-FORMFIELD-testfilenameextraction||Upload01||#','">')-2)

sample form : http://dev.ssp7.smt-x.com/Forms/form.aspx?adminmode=1&id=428

Method 2:

 GetXmlProperty('#REPLACE-FORMFIELD-UploadXmlTest||fuXml||#', '/A/@HREF')

sample form : http://dev.ssp7.smt-x.com/Forms/form.aspx?adminmode=1&id=502


Example 3 : return all data after a space

From 'blabla Eric', I want to keep everything after the space, so only 'Eric' SUBSTRING('#1#', INDEXOF('#1#', ' ') + 1)