Okay
  Public Ticket #3328115
Autopopulate data entry fields
Closed

Comments

  • kim wiil started the conversation

    Hello. 

    So now I'm at the data entry step. 

    My problem with the user id is almost solved by using the feature single select entry, or what you call it. 

    Its a great feature, but it doesn't fulfill my need 100 percent. 

    Is it possible when you to select a number from the dropdown ''cvr number'', and you choose a cvr number to auto-populate the other data entry field? 

    In my case, the user, id, cvr, p nr, address, post code, and city always follow the collection data. 

    So when choosing cvr number, or whatever field, its automatic autopopulate the other field by guessing the value from previous data entry?

  •  1,667
    Miloš replied

    Hi, kim.

    Apology for the late reply.

    I recall from the other tickets that you were combining various data,  

    and that the main goal was to filter the table for groups of users who share the same "CVR number", right?

    -

    Not sure if i fully understand what you described here;

    1. When you say "single select entry",  did you perhaps make a foreign key column relation to pull data from another table,

    so the Editor Input Type is Single value selectbox?

    9843865113.png
    6191565756.png

    If you can confirm that is what you meant, please.


    2. About the second part, can you elaborate a bit more,

    is it possible to show us some screenshots or record a Video so that we can see how you have set up this data and column relations?

    I am honestly not understanding your setup exactly,

    and not sure what you mean by auto- populating other fields by a value from previous data entry.

    As far as i am aware, we do not have any kind of feature/solution like that,

    but if you could clarify everything a bit more and we will do our best to help.

    If you send anything that shows any kind of sensitive informations, please use the PRIVATE response, for safety.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • kim wiil replied

    Hello. 
    Thanks for reply. 

    So i have made a document with pictures that explain what I mean. I hope it's understandable :)


    So I will try to explain in this document. I N the picture above shows the SQL table (Create a collection table) that are linked to, what I have named ‘’Data Admin’’, the main table. This SQL table is made for the employees to add new collection data to the table. The employees are only allowed to create a collection, but cannot edit, and cannot delete. In many of my previous inquiry I have focus on using the CVR NR as identifier, which is not that easy to do, even with custom coding.

    I have also written a code where, when you do data entry, the code automatic guess the value in the other fields if the code find a match in the data table. But it dosent relly works as expected. But maybe you already a function simlitar to this. Example: The userid (Kunde nr.) always follow the cvnr, pnr, adress, postcode, city. Like this:

    Which mean the customers adress is almost the same everytime. Only our very big customers have many location, but cvrnr, userid is always the same, dosent matter collection location. So basicly, the only fields that always will change is fields where we write in the amount of tires collected from a customers location. S o lets say im picking up tires from ‘AK autoservice’, and this client userid is ‘1066’, so when I enter the userid ‘1066’ it guesses the other fields if it finds a match in the datatable

    Attached files:  Autofill logic for WPDATATABLES.png

  • kim wiil replied

    IM not sure if you got all the pictures?

  •  1,667
    Miloš replied

    Hi, kim.

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusuallly high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    Thank you for this detailed explanation and the screenshot.

    Now i can understand perfectly what you mean and the use-case.

    I did not realise that before, but now i see, thank you for the clarification.

    -

    I am truly sorry to disappoint you, but at the moment, we don't have any built-in function or feature that can be used in order for a selection from one field to affect auto-populating other fields during Editing or adding a New Row,

    that could make another field to follow,

    as your example - if we chose a user that has an userid ‘1066’ in that remote table,

    and then for other fields to "guess" the right values based on that - if this matched in the other table(s).

    When we edit in our plugin,  each field is independent of other Editing Fields in the Editing Modal.

    The only way how you can "pre populate some values",

    for example in this Dummy Table "Orders",  this "Employees Column" is a foreign Key Relation field from remote table "Employees".

    In that table, each employee got a unique ID.

    The only way i can pre-populate so that our plugin will "guess" which employee has which name,

    is to first input the integer values as ID's in that field,

    then later when i change it to String and say "foreign key that column as Employees";

    then the "Store Value" is going to automatically pick up and match the Employee ID with the Employee Name ( because i use Employee Name as Display Value);

    4495698261.png
    9058013801.png

    But, as i said - each field will only pre-populate itself, depending how we set the foreign key relation with each Employee unique ID,

    which is different from what you're trying to do, of course.

    -

    This is a very interesting use-case, i must say - but unfortunately, at the moment, we do not have anything similar like that.

    You would have to try to make a custom solution, but we honestly don't have any working example or an idea what you might try to achieve that when editing with our plugin.

    You can make a suggestion for our developers, though, and they will do their best to come up with development ideas for the future, as soon as possible.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • kim wiil replied

    Hi Milo. 

    I have looked into it again, and do you think this would work? 


    <?php 

    // Get the WPDataTable object. 
    $wdt = new WPDataTable('table_id');

    // Check if the form is submitted
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        // Get the Firmanavn, kunde nr., CVR nr., P-nummer, adresse, and Bynavn from the input fields.
        // Sanitize user inputs
        $Firmanavn = sanitize_text_field($_POST['Firmanavn']); 
        $Kunde_nr = sanitize_text_field($_POST['Kunde_nr']);
        $Cvr_nr = sanitize_text_field($_POST['Cvr_nr']);
        $P_nummer = sanitize_text_field($_POST['P_nummer']);
        $Adresse = sanitize_text_field($_POST['Adresse']);
        $Bynavn = sanitize_text_field($_POST['Bynavn']);

        // Get the rows from the database that match the firmanavn, kunde nr., CVR nr., P-nummer, adresse, and bynavn.
        // This is where you should use a prepared statement
        $rows = $wdt->query("WHERE `Firmanavn` = '$Firmanavn' AND `Kunde_nr` = '$Kunde_nr' AND `Cvr_nr` = '$Cvr_nr' AND `P_nummer` = '$P_nummer' AND `Adresse` = '$Adresse' AND `Bynavn` = '$Bynavn'");

        // If there are any rows, then loop through them and autopopulate the fields.
        if ($rows) {
            foreach ($rows as $row) {
                foreach ($row as $field => $value) {
                    // If the field is not the Firmanavn, kunde nr., CVR nr., P-nummer, adresse, and Bynavn, then autopopulate it.
                    if ($field !== 'Firmanavn' && $field !== 'Kunde_nr' && $field !== 'Cvr_nr' && $field !== 'P_nummer' && $field !== 'Adresse' && $field !== 'Bynavn') {
                        echo '<input type="text" name="' . esc_attr($field) . '" value="' . esc_attr($value) . '">';
                    }
                }
            }
        }
    }
    ?>

  •  1,667
    Miloš replied

    Hi, kim.

    This is a custom PHP code, and i am truly sorry to disappoint you, but our developers are extremely busy and they do not have time for any custom work in the near future.

    Our Support does not cover checking if a custom PHP code will work,

    we can only provide you wish some examples that we made ourselves or if our users shared them with us ( if they claim that it works for them).

    For something like this, sadly, we still did not get the time to try anything like that,

    and we can't confirm if your PHP code will work for your use-case.

    You would have to try this and let us know if you manage to get it working, then you could share with us what you did,  and we can make a note of it for other users,

    and of course, to pass it to our developers, it might help them save some time when they start working on a built-in solution.

    Again, I'm truly sorry that we can't test something like this at this time and we can't confirm if it should work as intended or not.



    If you have coding skills and wish to try to make a custom solution now,

    you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.

    Please be advised that custom solutions with hooks are not included in our support.

    You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.

    ( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables