Patterns Archives | SnapSurveys Support documentation for Snap Surveys products Mon, 09 Sep 2024 11:14:12 +0000 en-GB hourly 1 https://wordpress.org/?v=6.4.5 https://www.snapsurveys.com/support-snapxmp/wp-content/uploads/2020/07/favicon-32x32-1.png Patterns Archives | SnapSurveys 32 32 Testing a pattern https://www.snapsurveys.com/support-snapxmp/snapxmp/testing-a-pattern/ Thu, 07 Mar 2024 09:56:09 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11421 If the test fails either the text does not fit the pattern or the pattern needs editing. Result and Modify Case only alter the way the data is displayed in the analysis.

The post Testing a pattern appeared first on SnapSurveys.

]]>
  • Once you have created, cloned or modified a pattern, you can test it by clicking Test on the Pattern Properties dialog. The test dialog appears.
  • Pattern Match Test dialog
    1. Type in a sample of data into the Text box. For example, for the date pattern you might type in 20201231.
    2. If the pattern works correctly it will show that it has matched the data, the result that will display in Snap and the Values of each of the component parts.

    If the test fails either the text does not fit the pattern or the pattern needs editing.

    Testing a pattern

    Result and Modify Case only alter the way the data is displayed in the analysis.

    The post Testing a pattern appeared first on SnapSurveys.

    ]]>
    Character selection dialog https://www.snapsurveys.com/support-snapxmp/snapxmp/character-selection-dialog/ Thu, 07 Mar 2024 09:55:50 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11429 The Character selection dialog allows you to select specific characters to use in a pattern. Characters Use Control with left-click or Shift with left-click to select the characters you wish to use. Case Sensitive Select to make your selection case-sensitive.

    The post Character selection dialog appeared first on SnapSurveys.

    ]]>
    The Character selection dialog allows you to select specific characters to use in a pattern.

    CharactersUse Control with left-click or Shift with left-click to select the characters you wish to use.
    Case SensitiveSelect to make your selection case-sensitive.

    The post Character selection dialog appeared first on SnapSurveys.

    ]]>
    Repeat pattern components https://www.snapsurveys.com/support-snapxmp/snapxmp/repeat-pattern-components/ Thu, 07 Mar 2024 09:55:32 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11426 The Repeat dialog allows you to specify how often a component or pattern repeats. Once only No repeat (default). Exactly The component repeats the specified number of times. Optional The component is optional (not required for match). Up to The component is mandatory but cannot repeat more than the specified number of times. 0 or […]

    The post Repeat pattern components appeared first on SnapSurveys.

    ]]>
    The Repeat dialog allows you to specify how often a component or pattern repeats.

    Once onlyNo repeat (default).
    ExactlyThe component repeats the specified number of times.
    OptionalThe component is optional (not required for match).
    Up toThe component is mandatory but cannot repeat more than the specified number of times.
    0 or moreThe component is optional but can repeat any number of times.
    1 or moreThe component is mandatory but can repeat any number of times.
    At leastThe component must repeat the specified number of times or more.
    BetweenThe component must repeat at least the lower number of times but no more than the higher number.

    The post Repeat pattern components appeared first on SnapSurveys.

    ]]>
    Match Pattern dialog https://www.snapsurveys.com/support-snapxmp/snapxmp/match-pattern-dialog/ Thu, 07 Mar 2024 09:55:10 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11432 The Match Pattern dialog is used to define text to be matched. Match Enter the text string and patterns to match. Select and right-click to apply repeats to the selected text. Right-click in the field to insert components. Right-click to display context menu. Repeat Open the repeat dialog to specify how often a component or character can […]

    The post Match Pattern dialog appeared first on SnapSurveys.

    ]]>
    The Match Pattern dialog is used to define text to be matched.

    MatchEnter the text string and patterns to match. Select and right-click to apply repeats to the selected text. Right-click in the field to insert components. Right-click to display context menu.
    RepeatOpen the repeat dialog to specify how often a component or character can be or must be repeated.
    Any CaseCheck to make match case insensitive
    ComponentsSelected or defined components that have been added to the pattern
    Global PatternsSystem components provided with Snap
    CharactersOpen the Character Selection dialog to add characters to the match

    The post Match Pattern dialog appeared first on SnapSurveys.

    ]]>
    Component properties dialog https://www.snapsurveys.com/support-snapxmp/snapxmp/component-properties-dialog/ Thu, 07 Mar 2024 09:54:45 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11435 The component properties dialog is used to create components to use in patterns. Components are essentially patterns that can only be used within the parent pattern. They allow you to specify repeats of groups of characters, and to identify elements within a pattern match. Name Name for the component. Should be as specific as possible. […]

    The post Component properties dialog appeared first on SnapSurveys.

    ]]>
    The component properties dialog is used to create components to use in patterns. Components are essentially patterns that can only be used within the parent pattern. They allow you to specify repeats of groups of characters, and to identify elements within a pattern match.

    NameName for the component. Should be as specific as possible.
    LabelMore detail about the component.
    ConsistentCheck to require the same match for the component in all uses in a single pattern.
    Less<<More>>Hide or display the Components panel.
    ComponentsThe list of components which are local to this component.
    MatchesThe list of matches which are valid for this component.
    ResultThe string or component result that the match is changed to. If empty, any sub-component results will be used. If there are no component results, no transformation will take place. Right-click in field to select a component name to use as the result.
    Modify CaseTransform the result of applying the component to the specified case. The available options are lower case, Normal, Sentence case, Title case, UPPER CASE.

    The post Component properties dialog appeared first on SnapSurveys.

    ]]>
    Patterns properties dialog https://www.snapsurveys.com/support-snapxmp/snapxmp/patterns-properties-dialog/ Thu, 07 Mar 2024 09:54:19 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=11423 The Pattern properties dialog allows you to view or create patterns. Patterns define the format of the data that a respondent should enter when they are completing the questionnaire. Snap XMP Desktop comes with a library of patterns. You can also create your own patterns. Viewing the patterns Name Name for the pattern. Label More detail […]

    The post Patterns properties dialog appeared first on SnapSurveys.

    ]]>
    The Pattern properties dialog allows you to view or create patterns. Patterns define the format of the data that a respondent should enter when they are completing the questionnaire. Snap XMP Desktop comes with a library of patterns. You can also create your own patterns.

    Viewing the patterns

    1. Open the Patterns dialog from the View | Patterns menu on the Snap XMP Desktop menu.
    2. To open the Pattern Properties dialog you can
      • Select a pattern in the list and click the View or Modify button. The patterns supplied with Snap XMP are read-only.
      • Click the New button to create a new pattern.
    NameName for the pattern.
    LabelMore detail about the name and describes the pattern in the Patterns dialog.
    ReferenceThis gives further details about the source of the information for the Pattern: for example, a website address; a database; a reference book.
    UsageThe response type that uses the Pattern. The Other Patterns Only option, means that the pattern is only for use within other Patterns.
    DecoratedAdd fixed-position known characters in fixed length patterns (e.g. separators for dates).
    Less<<More>>Hide or display the Components panel.
    ComponentsThe list of components which are used in this pattern.
    MatchesThe list of matches which are valid for this pattern.
    ResultThe text or component result after applying the pattern. If this is empty, any component results will be used. If there are no component results, no transformation will take place. Right-click in field to select a component name to use as the result.
    Modify CaseTransform the result of applying the pattern to the specified case. The choices that are available are: lower case, Normal, Sentence case, Title case, UPPER CASE.

    The post Patterns properties dialog appeared first on SnapSurveys.

    ]]>
    Introduction to patterns https://www.snapsurveys.com/support-snapxmp/snapxmp/introduction-to-patterns/ Fri, 10 Jul 2020 09:58:36 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=1683 Patterns are used to define the format of the data that a participant should enter when they are completing the questionnaire. In data entry, patterns are used to In filters and derived variables, you can Snap XMP Desktop is supplied with a library of pre-defined Patterns. You can also create your own using the Patterns […]

    The post Introduction to patterns appeared first on SnapSurveys.

    ]]>
    Patterns are used to define the format of the data that a participant should enter when they are completing the questionnaire.

    In data entry, patterns are used to

    • Ensure that respondents or data entry personnel enter the correct format for information such as postcodes, zip codes or National Insurance numbers. Pattern matching is used to check whether the answer is a possible match in the pattern.
    • Convert the data into a standard form, such as adding currency symbols in quantity data.

    In filters and derived variables, you can

    • Use the pre-defined patterns to temporarily change data, for example, converting literal responses to lower case
    • Use one part of a pattern made up of several defined parts for example, the area code in a phone number, and use that part to analyse the data.

    Snap XMP Desktop is supplied with a library of pre-defined Patterns. You can also create your own using the Patterns dialog from View|Patterns.

    System patterns

    Snap XMP Desktop is supplied with a library of pre-defined patterns that include patterns for:

    • Literals such as email address, postcode and zip code
    • Dates such as date in words
    • Quantities such as currency and decimal number
    • Components that can be used to build your own patterns, but cannot be used directly in variable details or as filters. For example letter or digit.

    For each pattern there is

    • A unique pattern name
    • A form which identifies which types of variable can use the pattern
    • A label describing how the pattern is used.

    Applying a pattern in the questionnaire window

    1. Open the survey in the questionnaire window.
    2. Select a question, right-click and choose Variable Properties.
    3. Ensure you have the right Response selected for the question. Patterns are only available for open-ended questions, including date, time, literal, and quantity questions.
    4. Click the Source Pattern list to view the existing patterns for use with the variable.
    Setting a pattern for a question in the Variable Properties dialog
    1. If the pattern you were expecting to see is not showing you might need to change the Response type for the question. Only those patterns that are relevant to the response type are shown in the list of Source Patterns.
    2. Click OK to apply the pattern to the variable or Cancel to abandon any changes that you have made.
    3. Select SaveIcon.png in the Questionnaire window to save the Pattern and any other changes to the questionnaire.

    Applying a pattern in the Variables window

    You can set the pattern for a variable using the Variable Details dialog.

    1. Click VariablesIcon.png to open the Variable window.
    2. Select the variable to which you wish to apply a Pattern and double click to open the Variable Details dialog.
    3. Click DesignModeIcon.png to toggle definitions of the variable and you will see that the Variable Details now display information including Pattern.
    4. Click the Pattern drop-down and a list of patterns, applicable to the response type, is shown.
    Setting a pattern for a question in the Variable Details window
    1. Choose the required pattern and click SaveIcon.png to save the changes.

    Patterns during data entry

    There are two ways of using patterns in data entry.

    • Check the data against the requirements. If it does not match, display an error message.
    • Check the data against possible matches and change it to a standard format. If the data entered conforms to a number of entry options (for example, “two”, “2” or “£2”) included in the pattern the data is accepted then converted to a standard format (for example, all of the above responses are converted to “2” for analysis).

    Composition of a pattern

    Patterns are composed of components and matches.

    • matches are text strings that a response must match
    • components consist of one or more text strings that part of a response must match

    Using components within matches means that:

    • specific parts of a respondent’s answer can be identified and scrutinised at the analysis stage of the survey process
    • a consistent style of result can be output and analysed

    In the example below, the pattern has one match and four components.

    Creating a pattern

    In addition to the text string used to match the response, you can add further details about the pattern.

    • you can add data in the Reference field about where you accessed the information for the pattern; for example, a website address; a database or a reference book
    • you can specify what type of response the pattern can be used within the Used In field (select Other Patterns Only for patterns that will only be used when creating another pattern)

    The example below shows two Matches for year; {4 digits} and {2 digits}, signifying that there can either be 4 digits or 2 digits representing the year part of the date.

    Adding the year component

    The Matches for the month component can be seen below. There are 5 matches within the component, signifying that either 12, 11 or 10 is acceptable or a zero followed by a digit, such as 05 or a single digit, such as 5 (to represent May).

    Adding the month component

    The separator component of this DD/MM/YYYY pattern has been set up to accept dashes, obliques and full stops as the divider between the various parts of the date.

    Adding a separator component

    Creating a new pattern example

    This example shows how the DD/MM/YYYY pattern can be created. This ensures that the respondent enters a date with day-month-year format, where the year part can include a two-digit century.

    The separator between day/month and month/year can be any of “/”, “-” or “.”.

    All these are valid dates: 06/08/2020; 6-8-2003; 06.8.2020; 6/08/20 for this pattern.

    Examples of invalid dates are: 6th August 2020; 06/Aug/2020.

    1. Select View | Patterns to open the Patterns dialog. (Prior to build 12.10 this was on the Tailor menu.)
    2. Select New in the Patterns dialog to display the Pattern Properties dialog.
    3. Choose a name for the pattern and type it in to the Name box. Try to make the name as specific as possible to its purpose. For example, rather than write it as Date write it as DD/MM/YYYY so that its format can be identified easily by others using it.
      • Enter a Label giving more information. This will be displayed when the pattern is selected on the front page of the Patterns dialog.
      • You can enter a reference in the Reference giving specific details about where you accessed the information for the Pattern: for example, a website address; a database; a reference book.
    4. Select the response type that the pattern will be used with from the Usage drop-down list. Select Other Patterns Only for patterns that will not be available directly to variables, but only for use within other Patterns.
    Pattern Properties dialog
    1. You can create patterns by using a plain text string as a match, however, it is sometimes more effective to build the match up from components.

    Creating components to use in your match

    1. Click More to display the Components part of the Pattern Properties dialog.
    Pattern Properties dialog
    1. Click New to the right of the Components area to display the Component Properties dialog.
    Component properties dialog
    1. Type in a Name for the Component you are writing. For example for DD/MM/YYYY you might call one of the components ‘Day’, which you would type in the Name space. In Label you might write ‘Day part of Date’.
    2. Select New to create a Match for the Component.
    3. The Match Pattern dialog displays.
    4. You build up the pattern to match from text and components. You can use the buttons on the dialog to select items, or right-click the Match field to display the context menu.
    5. Either type a text string into the Match box or double click one of the Global Patterns to select it.
      • For the day component you would want one digit or two digits recognised, as respondents would be likely to type in either one or two digits when answering this part of the question. For example: 01 or 1 when referring to the first day of the month.
      • If you are looking for a particular character click Characters… to show more options in the Character Selection dialog.
      • Highlight the characters required and click OK. If a letter is selected, both the lower and upper case version will show in the match unless Case Sensitive is ticked.
    Matching a pattern
    1. For the first two-digit match of the Day example:
      • either double-click digit in Global Patterns twice
      • or double-click digit and then use Repeat to permit multiple copies.

    The Repeat button gives options for each part of the Component. Ensure that the part of the Component you want to affect is highlighted before selecting a Repeat command. Each of the commands creates constraints which the data must adhere to in order to fit the pattern.

    Setting the repetition of a pattern component
    1. Click OK to return to the Match Pattern dialog and OK again to return to the Component Properties dialog.
    2. Once satisfied with all the Components, return to the Pattern Properties dialog.

    Deleting components

    If you wish to delete any of the Components, highlight it and click Delete. You are shown a warning message and asked to confirm that you want to delete the component.

    Creating the match from the components

    Viewing the pattern properties
    1. On the Pattern Properties dialog you will see that you now have a list of Components but no overall Match for the pattern. Select New under the Matches part of the dialog and the Match Pattern dialog will display again
    Matching a pattern
    1. The newly built components will show in the left-hand column. You can now create a match from both your components and the existing Global Patterns. Characters and Repeat work in the same way as previously explained.
    2. Select the year (4 digit) component, then month and day.
    3. Click OK when you have finished to return to the Pattern Properties dialog.

    Testing a pattern

    1. Once you have created, cloned or modified a pattern, you can test it by clicking Test on the Pattern Properties dialog. The test dialog appears.
    Pattern Match Test dialog
    1. Type in a sample of data into the Text box. For example, for the date pattern you might type in 20201231.
    2. If the pattern works correctly it will show that it has matched the data, the result that will display in Snap and the Values of each of the component parts.

    If the test fails either the text does not fit the pattern or the pattern needs editing.

    Testing a pattern

    Result and Modify Case only alter the way the data is displayed in the analysis.

    Modifying, cloning and deleting patterns

    1. Select View | Patterns to open the patterns dialog. (Prior to build 12.10 this was on the Tailor menu.)
    2. Highlight the required Pattern and click either Clone or Modify to access the Pattern Properties dialog box and then follow the instructions for creating a pattern provided earlier in this section.
    3. If you wish to delete a pattern, click Delete. You are shown a warning message and asked to confirm that you want to delete the component.

    You are unable to delete any of the System patterns provided with the software.

    If you delete a component, you will need to modify any matches that contain the component, otherwise the associated pattern will not work correctly.

    Always ensure that the longest match string is at the top of the list to improve the search efficiency when the pattern is in use. For example in a list of Matches of {digit} {digit}, {digit} {letter}, {digit} they should be listed in this order to identify answers with two digits before classifying them as errors from the other two matches.

    Copying patterns between surveys

    If you already have a survey containing patterns that you need, you can copy these to another survey by saving them in SnIF format or to the clipboard.

    1. Open the survey containing the patterns you wish to copy.
    2. Select View | Patterns to open the Patterns dialog. (Prior to build 12.10 this was on the Tailor menu.)
    3. Click Export to display the Pattern Export dialog box. The format will be set to SNAP Xml Format (SnIF Xml).
    Pattern Export dialog
    1. Set the Destination as Clipboard. If you are saving a very large amount of data, you may need to save to a file instead.
    2. Enter the names of the patterns you wish to export in the Content field (leave blank to export all user-created patterns).
    3. Click OK to export the selected patterns. A confirmation message appears showing the number of patterns exported (this will not include standard patterns provided in all surveys).
    4. Open the survey that you wish to copy the patterns to.
    5. Select View | Patterns to open the Patterns dialog. (Prior to build 12.10 this was on the Tailor menu.)
    6. Click Import to display the Pattern Import dialog box. The format will be set to Snap Interchange Format (SnIF).
    Pattern Import dialog
    1. Set the Source to the file or Clipboard that you previously exported the patterns to.
    2. Click OK to import the patterns. A confirmation message appears showing the number of patterns imported.

    The post Introduction to patterns appeared first on SnapSurveys.

    ]]>