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

How to deal with an incendiary email that was recalled

kill -0 <PID> は何をするのでしょうか?

How old is the day of 24 equal hours?

How to say "Brexit" in Latin?

IGBT transistor with auxiliary emitter

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

Concatenation of fieldvalue and fieldname (handling of NULL)

Spring Boot request header return null value

Why is Agricola named as such?

If I delete my router's history can my ISP still provide it to my parents?

What is the purpose of easy combat scenarios that don't need resource expenditure?

SET NOCOUNT Error in handling SQL call after upgrade

LuaTex and em dashes

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

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

How can I display a custom maintenance message on Magento 2.2.4

How does Leonard in "Memento" remember reading and writing?

How to prevent users from executing commands through browser URL

I will be going to Sweden on business purpose .Can I visit London from Sweden and how much UK visa will cost?

Citing paywalled articles accessed via illegal web sharing

Advice for a new journal editor

A title for a history book

Do authors have to be politically correct in article-writing?

speculum - A simple, straightforward Arch Linux mirror list optimizer



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
    3 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
    3 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 3 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 4 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
    3 hours ago
















  • 2





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

    – BERA
    3 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
3 hours ago







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

– BERA
3 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 3 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

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...