Concatenation of fieldvalue and fieldname (handling of NULL)one label for two-lane roads (osm, qgis,...

Which one of these password policies are more secure?

A title for a history book

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

Consequences of lack of rigour

In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?

Difference between i++ and (i)++ in C

Play Zip, Zap, Zop

LuaTex and em dashes

Why are the books in the Game of Thrones citadel library shelved spine inwards?

How old is the day of 24 equal hours?

What is the difference between rolling more dice versus fewer dice?

SET NOCOUNT Error in handling SQL call after upgrade

How can animals be objects of ethics without being subjects as well?

Non-Cancer terminal illness that can affect young (age 10-13) girls?

Cookies - Should the toggles be on?

How to say "Brexit" in Latin?

Can we harness gravitational potential energy?

Can a long polymer chain interact with itself via van der Waals forces?

Why do neural networks need so many training examples to perform?

Why zero tolerance on nudity in space?

Making him into a bully (how to show mild violence)

Can a hotel cancel a confirmed reservation?

Why is Agricola named as such?

The use of the spellings -zz- vs. -z-



Concatenation of fieldvalue and fieldname (handling of NULL)


one label for two-lane roads (osm, qgis, postgis)Creating single null value for raster bordersQGIS combining categorized valuesHow to count the number of polygons within a grid?Removing Null Values and Slicing ResultsRepresenting NULL data for a numeric field in ArcGIS (symbology)Grouping values by type and counting themAverage of polygons within mask polygonNull handling in QGIS grid rank filterBlank values in attribute table don't work as null in QGIS?













1















I'm relatively new to QGIS and I want to tackle the problem below.



Let's say I have a trench contraining two types of ducts
Number of ducts can range



I have created two fields for said trench. (Type 1 and Type 2)



The values in each field are the numbers of each type of duct that the trench contains.



I would like to label it something like this (eg lets say that trench contains 2 ducts of type one and one duct of type 2)



Label: 2xType1,Type2



Also, what can i do if one of the values is NULL ?



In that case ( lets say type1 is NULL) I would like the label to be
Label:Type2



I am looking for a compact solution since the actual number of duct types is 5










share|improve this question









New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2





    What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

    – BERA
    2 hours ago


















1















I'm relatively new to QGIS and I want to tackle the problem below.



Let's say I have a trench contraining two types of ducts
Number of ducts can range



I have created two fields for said trench. (Type 1 and Type 2)



The values in each field are the numbers of each type of duct that the trench contains.



I would like to label it something like this (eg lets say that trench contains 2 ducts of type one and one duct of type 2)



Label: 2xType1,Type2



Also, what can i do if one of the values is NULL ?



In that case ( lets say type1 is NULL) I would like the label to be
Label:Type2



I am looking for a compact solution since the actual number of duct types is 5










share|improve this question









New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2





    What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

    – BERA
    2 hours ago
















1












1








1








I'm relatively new to QGIS and I want to tackle the problem below.



Let's say I have a trench contraining two types of ducts
Number of ducts can range



I have created two fields for said trench. (Type 1 and Type 2)



The values in each field are the numbers of each type of duct that the trench contains.



I would like to label it something like this (eg lets say that trench contains 2 ducts of type one and one duct of type 2)



Label: 2xType1,Type2



Also, what can i do if one of the values is NULL ?



In that case ( lets say type1 is NULL) I would like the label to be
Label:Type2



I am looking for a compact solution since the actual number of duct types is 5










share|improve this question









New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm relatively new to QGIS and I want to tackle the problem below.



Let's say I have a trench contraining two types of ducts
Number of ducts can range



I have created two fields for said trench. (Type 1 and Type 2)



The values in each field are the numbers of each type of duct that the trench contains.



I would like to label it something like this (eg lets say that trench contains 2 ducts of type one and one duct of type 2)



Label: 2xType1,Type2



Also, what can i do if one of the values is NULL ?



In that case ( lets say type1 is NULL) I would like the label to be
Label:Type2



I am looking for a compact solution since the actual number of duct types is 5







qgis null concatenation






share|improve this question









New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









Vince

14.7k32749




14.7k32749






New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









SundrawSundraw

61




61




New contributor




Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sundraw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2





    What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

    – BERA
    2 hours ago
















  • 2





    What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

    – BERA
    2 hours ago










2




2





What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

– BERA
2 hours ago







What have you tried? You should be able to use the coalesce function in a label expression to hande nulls

– BERA
2 hours ago












1 Answer
1






active

oldest

votes


















3














Maybe use something like the following:



replace(
if("id" > 0 and "id_1" > 0, "id" || 'x Type1, ' || "id_1" || 'x Type2',
if("id" = 0 or "id" IS NULL, "id_1" || 'x Type2',
if("id_1" = 0 or "id_1" IS NULL, "id" || 'x Type1', ''))), '1x', '')


Example






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "79"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Sundraw is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313873%2fconcatenation-of-fieldvalue-and-fieldname-handling-of-null%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Maybe use something like the following:



    replace(
    if("id" > 0 and "id_1" > 0, "id" || 'x Type1, ' || "id_1" || 'x Type2',
    if("id" = 0 or "id" IS NULL, "id_1" || 'x Type2',
    if("id_1" = 0 or "id_1" IS NULL, "id" || 'x Type1', ''))), '1x', '')


    Example






    share|improve this answer




























      3














      Maybe use something like the following:



      replace(
      if("id" > 0 and "id_1" > 0, "id" || 'x Type1, ' || "id_1" || 'x Type2',
      if("id" = 0 or "id" IS NULL, "id_1" || 'x Type2',
      if("id_1" = 0 or "id_1" IS NULL, "id" || 'x Type1', ''))), '1x', '')


      Example






      share|improve this answer


























        3












        3








        3







        Maybe use something like the following:



        replace(
        if("id" > 0 and "id_1" > 0, "id" || 'x Type1, ' || "id_1" || 'x Type2',
        if("id" = 0 or "id" IS NULL, "id_1" || 'x Type2',
        if("id_1" = 0 or "id_1" IS NULL, "id" || 'x Type1', ''))), '1x', '')


        Example






        share|improve this answer













        Maybe use something like the following:



        replace(
        if("id" > 0 and "id_1" > 0, "id" || 'x Type1, ' || "id_1" || 'x Type2',
        if("id" = 0 or "id" IS NULL, "id_1" || 'x Type2',
        if("id_1" = 0 or "id_1" IS NULL, "id" || 'x Type1', ''))), '1x', '')


        Example







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        JosephJoseph

        57.5k7100197




        57.5k7100197






















            Sundraw is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Sundraw is a new contributor. Be nice, and check out our Code of Conduct.













            Sundraw is a new contributor. Be nice, and check out our Code of Conduct.












            Sundraw is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313873%2fconcatenation-of-fieldvalue-and-fieldname-handling-of-null%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Benedict Cumberbatch Contingut Inicis Debut professional Premis Filmografia bàsica Premis i...

            Monticle de plataforma Contingut Est de Nord Amèrica Interpretacions Altres cultures Vegeu...

            Escacs Janus Enllaços externs Menú de navegacióEscacs JanusJanusschachBrainKing.comChessV