CA Service Management

 View Only
Expand all | Collapse all

PDM_IF bitwise-and comparsion

  • 1.  PDM_IF bitwise-and comparsion

    Posted Feb 03, 2016 12:29 PM

    Hello team!

     

    Referring to implementation guide I have found possibility to compare values by bitwise-and (PDM_IF &),

    I have tried several times, but haven't found any working condition,

    could anyone provide working example?

     

    PS: I'm running sdm 12.7 CP2.

     

    Regards,

    cdtj

    HTMPL:
    <PDM_IF "2 & 0"><!-- return true -->
    <PDM_IF 2 & 2><!-- return false -->
    
    JS:
    (2&0) // false;
    (2&2) // true
    


  • 2.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 03, 2016 02:42 PM

    I'll try to get to the VM to test a little later but please try:

     

    <PDM_IF "2" & "0">

     

    I seem to recall there is a more specific format required than what the Guide shows but I can't place it at the moment.

     

    J.W.



  • 3.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 03, 2016 02:57 PM

    Thanks for reply!

    I tried a lot of combinations, even "2 & 2" == "2", none of them are works... :C



  • 4.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 03, 2016 03:03 PM

    It has been a very long time since I needed to do a bitwise comparison.  Is there a specific task you are trying to accomplish?

     

    J.W.



  • 5.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 04, 2016 02:40 AM

    I have created new control, which is uses integer and can store multiple values, OOTB attribute like this is stored in USP_PREFERENCES and called web_preferences.

    JS control already done and I'm planning to publish it as regular PDM_MACRO, but usablity question can ruin all my plans.

    PDM_MACRO example (based on checkbox):

    <PDM_MACRO name=dtlBitwiseAnd hdr="ENV: SolMan" attr="z_env" key="1" on="Yes" off="No">

    <PDM_MACRO name=dtlBitwiseAnd hdr="ENV: SDM" attr="z_env" key="2" on="Yes" off="No">

    <PDM_MACRO name=dtlBitwiseAnd hdr="ENV: Other" attr="z_env" key="4" on="Yes" off="No">

    How it looks:

     

    in my example z_env = 5.

     

    Regards,

    cdtj



  • 6.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 04, 2016 08:51 AM

    Have you tried <PDM_IF "$args.z_env" == "5">



  • 7.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 24, 2016 11:29 AM

    Hi CelsoA

    Let's us know if you made it works as I think this can be useful for many

    /J



  • 8.  Re: PDM_IF bitwise-and comparsion

    Posted Feb 29, 2016 11:15 PM

    the question is still unresolved, I think that I tried all of combinations with "&" word, but didn't found correct syntax for PDM_IF bitwise-and comparsion



  • 9.  Re: PDM_IF bitwise-and comparsion

    Posted Mar 01, 2016 08:44 AM

    Hi  cdtj,

     

    I believe that bit-wise comparisons in PDM_IFs are not well constructed. Why you don't use Javascript if? It should work as expected and you can use exactly the way you are wanting.

     

    For example, instead of <PDM_IF 2 & 2></PDM_IF>, it would be: if (2 & 2) { }

     

    Regards,

     

    Diogo



  • 10.  Re: PDM_IF bitwise-and comparsion

    Posted Mar 01, 2016 10:33 PM

    Hi diogo.nobrega,

    yeah, I'm using js, but my opinion is that:

    - things described in Implementation Guide should work

    - javascript code passes to customer pages instead of PDM tags that being cutted on page preprocessing.

     

    Regards,

    Timur



  • 11.  Re: PDM_IF bitwise-and comparsion

    Posted Mar 02, 2016 02:32 AM

    Agree with you CDTJ when functionality is made available this must work as documented as we rely on it to develop our business process.

    When you buy a car you expect the break pedal to work as expected and stop the car vs. any other behavior



  • 12.  Re: PDM_IF bitwise-and comparsion

    Posted Mar 02, 2016 07:48 AM

    You're right. I think that in this situation, this could be considered a bug, so you could open a case. Did you already do this?