• Resolved nigel-lew

    (@nigel-lew)


    Hi. I have two fields that basically hold the same data type. They are numerical. I need to add them together on import.

    Stock would be a sane example for instance. Assume I have stock from 2 different suppliers I have to merge or add them together and dump them into one field.

    Is this possible? I am trying to help someone with something. This one is hurting my brain lol..

    TIA

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @nigel-lew You could use the PHP Function feature to manipulate your data as needed: https://www.wpallimport.com/documentation/import/custom-code/inline-php/

    If you can share your import file and specify the fields you’re attempting to add, I can assist further with specific code. Hope this helped!

    Thread Starter nigel-lew

    (@nigel-lew)

    Hi. Thanks very much for the quick response. I will drop that fellow a note and get field names for you. This is a stumper.

    Thread Starter nigel-lew

    (@nigel-lew)

    Ok… It is in fact safe to assume stock. My buddy has 2 fields or headers in the CSV file…

    cptstock & jhbstock those basically represent two different locations but I need to add them up or combine then and run this on a schedule.

    So if cptstock has 10 and jhbstock has 4 I need to drop 14 in to the stock field.

    Its sort of a fun question lol..

    Thanks again for your help.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @aakash8 https://www.ads-software.com/support/theme/generatepress/ I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    https://www.ads-software.com/support/guidelines/#the-bad-stuff

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us escalating this to the plugins team.

    It’s never necessary to do that. Here’s why.

    There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @nigel-lew,

    You can use the array_sum() PHP function to add the stocks together. For example:

    [array_sum(array({cptstock[1]},{jhbstock[1]}))]

    Thread Starter nigel-lew

    (@nigel-lew)

    Worked like a champ. Thanks for your time.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add (+) Two fields and merge to 1’ is closed to new replies.