How can I just give a display name to columns in CDT which has a different name in database Tables. Also i have more questions regarding Appian features

I have the following doubts:

Can I bring the output parameters from the different tables or views which is added as process variable-I hope it is possible?

Can I pass alias values as table input parameter like table column name is Purchase Order-but parameter name in the the JSON TEXT should be Order_Del_Number. both are same column, but I need to have the names changed.  How can I link them together. What are the different ways available in Appian.

Please check the below link for more details about the issue addressed before for similar  query.

https://community.appian.com/discussions/f/integrations/22331/web-api-that-connects-to-process-model--i-need-to-pass-input-parameter-different-and-get-a-different-output-parameter-can-anyone-help-me-out/87405#87405

Thanks

Sunu Sam

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    You can totally take any amount of anything you want from a database and make it a process variable.  Then you can take any field of a process variable and store it elsewhere.  You could read 2 tables into 2 CDTs, read a view into a 3rd, then use the type! type constructor or some other scripting to make a new CDT out of individual parts from those 3, or take parts and make them primitive type process variables by themselves.  You have all manner of options.

    The fields of a CDT can have any names you want, and each will link to one column in the table, which does not have to have a similar name.  It can be anything.  If you do want them to be different, you simply link fields to columns in the XSD file of the CDT.

    Likewise, when you're reading from the integration, you can save the individual components of the item you receive into process variables that have any names you'd like, or store the whole thing in a process variable with any name.  One solution would be to make a "fromService" CDT, and a "toDatabase" CDT .  Then you can use the type! type creator to put each field in the "fromService" into the "toDatabase", so that the names don't need any association at all.  You could even do some conversion or arithmetic in the process of going from one to the other (changing Decimals into Integers, concatenating firstName and lastName together, formatting phone numbers, etc.)

    You have lots of options.

  • HI David,

    thanks a lot for your response,

    the below is the code part I have added in the XSD to change only the display name is this correct please verify and let me know.

    Also After adding this to the CDT XSD 

    <xsd:element name="Order_Del_Number" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="PurchaseOrder", columnDefinition="VARCHAR(255)")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    UI associated with the  cdt stopped working

    below code is used for UI, please correct if it is wrong

    a!textField(
    label: "Purchase order (PO)/Sales order (SO)/STO/Requisition",
    labelPosition: "ABOVE",
    value: trim(
    index(
    ri!PF_Request,
    "PurchaseOrder",
    null
    )
    ),
    saveInto: {
    a!save(
    ri!PF_Request.PurchaseOrder,
    /*if(ri!PF_Request.GBEID=18,*/
    /*left(*/
    /*trim(*/
    /*save!value*/
    /*),10),*/
    /*trim(*/
    /*save!value*/
    /*))*/
    trim(save!value)
    )
    },
    required: true,
    validations:if(ri!PF_Request.GBEID = 18, if(regexmatch("^([0-9]{1,10})$",ri!PF_Request.PurchaseOrder),null,"The number provided should not contain any special character and can have upto 10 digits"), null )

    Thanks

    Sunu Sam

  • +1
    Certified Lead Developer
    in reply to sunus0001

    Look at the definition of the rule inputs.  Appian doesn't automatically update the version of the CDT being used.  So if you see ^1 or ^<version number>, you know that it's not using the latest.  Redefine the rule input, if that's what you see.  If not, we can troubleshoot what else it could be.

  • Hi David,

    I have updated rule input by clicking edit.Still i got this error mentioned below,Can you help for resolving the same.

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'or' [line 184]: Cannot compare incompatible operands of type Null and type Number (Integer)

    Thanks

    Sunu Sam

  • 0
    Certified Lead Developer
    in reply to sunus0001

    When comparing values, both operands must be of the same type. You try to compare a Null value to an integer.

    Try to add a tointeger() to the first operand.

  • Hi Stefan,

    After adding the below code change in CDT i got the error in interface, can you tell me what exactly the problem occured. I did not change anything in interface.

    <xsd:element name="Order_Del_Number" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="PurchaseOrder", columnDefinition="VARCHAR2(255 CHAR)")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    Someone reply to this ASAP.

    below is the interface code used.

    a!textField(
    label: "Purchase order (PO)/Sales order (SO)/STO/Requisition",
    labelPosition: "ABOVE",
    value: trim(
    index(
    ri!PF_Request,
    "Order_Del_Number",
    null
    )
    ),
    saveInto: {
    a!save(
    ri!PF_Request.Order_Del_Number,
    /*if(ri!PF_Request.GBEID=18,*/
    /*left(*/
    /*trim(*/
    /*save!value*/
    /*),10),*/
    /*trim(*/
    /*save!value*/
    /*))*/
    trim(save!value)
    )
    },
    required: true,
    validations:if(ri!PF_Request.GBEID = 18, if(regexmatch("^([0-9]{1,10})$",ri!PF_Request.Order_Del_Number),null,"The number provided should not contain any special character and can have upto 10 digits"), null )


    )

    Thanks

    Sunu Sam

  • Hi David

    Yes I may need help to troubleshoot this, because i made only changes to CDT,still its not working as expected.

  • Thanks to David for giving me ideas regarding the Appian version number-it helped me a lot to solve my issues to greater extended..I have solved the issue

  • Thanks a lot!  Stefan for the help. I have solved the issue, actually the error is due to the different column names and  it  is because of case-sensitive nature of column name, so only I got error.