PsppireImportAssistant: Use a more reliable way of setting the number of cases.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 5 Jun 2017 17:16:28 +0000 (19:16 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 6 Jun 2017 05:58:29 +0000 (07:58 +0200)
src/ui/gui/psppire-import-assistant.c

index f4f41efa64dee7b611f14a3d0aa3c3c5cd8ee99f..49e075a2977c19d5ef65c095017eebddd75d6b45 100644 (file)
@@ -1452,9 +1452,12 @@ first_line_append_syntax (const PsppireImportAssistant *ia, struct string *s)
 static void
 intro_append_syntax (const PsppireImportAssistant *ia, struct string *s)
 {
+  gint first_line = 0;
+  g_object_get (ia->delimiters_model, "first-line", &first_line, NULL);
+
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ia->n_cases_button)))
-    ds_put_format (s, "N OF CASES %d.\n",
-                  gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ia->n_cases_spin)));
+    ds_put_format (s, "SELECT IF ($CASENUM <= %d).\n",
+                  gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ia->n_cases_spin)) - first_line);
   else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ia->percent_button)))
     ds_put_format (s, "SAMPLE %.4g.\n",
                   gtk_spin_button_get_value (GTK_SPIN_BUTTON (ia->percent_spin)) / 100.0);