A Field that has not yet been 'named' will not accept data


#1

I have a database with several fields that have not yet been titled or named. If I attempt to enter data into those fields, the data does not get accepted but is merely ignored.


#2

I couldn’t duplicate this, but then I created a DB with 3 fields (A,B,C
as defaults), erased C as the title of the 3rd field, erased B as the
title of the 2nd, and erased A as the title of the first. The second
relabeled itself as 3 and the first as 2. They would both take data but
the one with no title wouldn’t take any. I suppose Panorama needs some
way to tell itself where you’re putting the data?


#3

Yes, the field does have to be empty of a ‘name’.

The database was the result of an import from iOS Numbers via a csv file. I did not recognize the multiple fields that Panorama X created due to the tacky/lousy exported file from Numbers but the result was several no name fields. Certainly a low priority for a bug, but Panorama should message the user when there are one or more non named fields.


#4

I was able to duplicate this, and have added it to Bitbucket.

This puzzled me at first but actually this is intentional. Panorama won’t let you set up two fields with the duplicate names. If you do, it adds a number on the end. So if you already have a Name field, and try to rename a second field as Name, it will change it to Name2. Since you already had a blank field, when you tried to make a second field blank, it renamed it to 2, i.e. blank with a 2 after it.


#5

Not quite the same scenario as trying to add data to fields with no name, but I am able to create a database with fields that have no name but contain data.

Using “New Database from Text File…” menu command I created a database from a Quickbooks export CSV file. The CSV file is loaded with columns with no name, several of which contain data. The data in these columns imports just fine into fields with no name. In fact, all the “no name” columns import as fields without a name, creating a slew of fields without names.

Which made me re-read this several times…

As these fields don’t have names, technically these fields do not have “duplicate names.” But it does seem that the “New Database from Text File…” menu command is bending the rules a bit.

All that aside, short of manually cleaning up my CSV file prior to import, any ideas for selecting all Fields with no name = empty, so I can readily delete all the empty no-name fields?


#6

Yes, I too got a mess of an import from QuickBooks. What I’d like is that Panorama might create temporary names for fields with data but no given field name, and also ignore any extra fields that are both devoid of data and field names. Keeping that extra junk serves no purpose.


#7

The CSV importer doesn’t check for duplicate field names. So not only could you create multiple fields with no names, you could also create multiple fields with the same non-empty name. This is actually ok (Panorama 6 allowed it), except it can cause confusion in formulas and programs that reference such fields. That’s why when you manually create a field, it won’t allow a duplicate. But when you import from a text file, it’s up to you to fix any duplicate field names.

There is no super easy way to do this. I just tried it, and

field ""

does not work.

But this procedure will do it (I just tried it and verified that it works).

field 1
loop
    if info("fieldname")=""
        deletefield
    endif
    right
until stopped

#8

Jim,
Thank you for that procedure. Worked like a charm!
JimA


#9

Robert,

Try this modification of Jim’s procedure below:

field 1
loop
if info(“fieldname”)=""
if («» = “”)
deletefield
endif
endif
right
until stopped

I added a step, if («» = “”), which checks that current field to see if it is empty before deleting the field. That worked for me, but I only tried it once.

Now that I’ve deleted all my “no-name” empty fields, I can’t add a new field without a name to test integrating a fieldname step, but I presume that could be done. I notice the fieldname formula seems to only provide for adding a fixed name, but I’m sure there’s some way to generate names on the fly.

Anyway, at least with what we have here we can clean out all those empty no-name fields. Progress!

••••••••••EDIT••••••••••
I just tested this on a new database and it doesn’t work. if («» = “”) doesn’t do what I thought it did. Back to scratchpad.


#10

Checking to see if the first record has data in that no name field opens up the liability of having data in other records in that field. The contents of that field for the entire database should be checked before deleting the field. This should be handled by Panorama during the import procedure.


#11

I’ve been futzing about with combining count and countsummaries statements and functions, thinking if I insert a count statement into the loop, the procedure could identify fields where info(“fieldname”)="" AND the summary count is “0”, and then deletefield.

In other words, the procedure would select for fields with no name that are empty, then delete that field.

But, no success.

Before running the procedure with the deletefie statement, I wanted to first figure out if I could select for fields that have no name AND are empty. In this vein, here are two attempts to get the procedure to stop if the count summary = 0

field 1
loop
if info(“fieldname”)=""
count
stoploopif countsummaries(0)=“0”
endif
right
until stopped
field 1

and

field 1
loop
if info(“fieldname”)=""
local sumcount
count
sumcount = countsummaries(0)
stoploopif sumcount=0
endif
right
until stopped
field 1

Count works fine, only counting records in fields that have no name. But I can’t figure out how to get the procedure to acknowledge when the count summary = 0.

Here’s a screenshot of a segment of the datasheet and summary records. The summary records with 66, 2, and 0 values are all fields with no names. The empty summary records, such as that date field, all have field names.

22

Am I on the right track?


#12

How about:

loop
If arraybuild( ¶, "", {«»})="" and info("fieldname")=""
    deletefield
Else
    right    
Endif
until stopped
field 1

Check out automaticfieldname(


#13

Gary,
Wow.

I’m diving back into the documentation to brush up on my thin grasp of arraybuild to better understand how this works. I think I get it.

And thank you for the automaticfieldname function. I’m off to the races.

Thank you!


#14

arraybuild( is awesome, I use it all the time.

In this particular application, another option would be the aggregate( function. This formula will return true if the current field is empty (has no data), no matter what type of field it is.

aggregate({sizeof(info("fieldname"))},"maximum") = 0

If the database is large the aggregate( function will probably be faster than arraybuild(, especially if the field is not empty. The arraybuild( is taking time to generate a potentially large array that we really don’t need, aggregate( avoids that.


#15

@RAmeeti - Robert,

Gary’s procedure works like a charm to delete empty no-name fields. (I haven’t tried Jim’s aggregate method yet, mostly because my database is relatively small, but that’s on the spare time upgrade list.)

In my case, I’m still left with three no-name fields that contain data. In the time it took to write this I could easily go through the database and edit those field names, but in an effort to make progress towards automating the whole process I find the following works to isolate those remaining no-name fields:

for fn,1,info(“fieldcount”)
field fn+0
local zfieldname
zfieldname =info(“fieldname”)
stoploopif zfieldname =""
editfieldname
endloop
field 1

It’s not perfect, but it does scan field names left to right, stops at each field missing a name, opens the field name properties window, and puts the cursor in the name field. After giving the field a name I can run the procedure again and it moves to the next empty field and repeats.

Would be nice to trigger a repeat of the procedure upon entering the field name and confirming it by pressing Enter (Return), but for now this is micro-progress.


#16

I just tried the aggregate( alternative and found at that it does not work with a field that has no name so that even if the field without a name had data inside it would still return 0 and end up being deleted.

This can all be handled all at the same time as the rest with an addition to the original code:

loop
If arraybuild( ¶, "", {«»})="" and info("fieldname")=""
    deletefield
Elseif info("fieldname")=""
    setfieldproperties initializedictionary("NAME",automaticfieldname("Test"))
    right
Else
    right    
Endif
until stopped
field 1

Note that I have added a sample prefix for use with the automaticfieldname( function which you can change as needed or omit if desired.


#17

I didn’t think of that. Now that you mention it, I’m surprised that the arraybuild( formula did work.


To automatically give a name to all of the untitled fields, how about this code, which should name them Untitled1, Untitled2, Untitled3 etc.

for fn,1,info("fieldcount")
    field fn+0
    if info("fieldname")=""
        fieldname automaticfieldname("Untitled")
    endif
endloop
field 1

Of course if you don’t like Untitled you could pick a different prefix.


Just for educational purposes, a couple thoughts about your code. First of all, this code:

local zfieldname
zfieldname=info("fieldname")

in Panorama X could be replaced with 1 line

let zfieldname=info("fieldname")

However, in this case the variable is unnecessary, you could have just said:

stoploopif info("fieldname")=""

#18

Jim -
Thank you for the tutorial at the end there. It’s very much appreciated.

I had looked at automaticfieldname, but mistakenly thought it only applied to new fields. Thank you for showing me otherwise.
JimA