Forums

Forums / General Discussions / How to remove a value from a tpc lookup

How to remove a value from a tpc lookup

2 posts, 1 answered
  1. Madson Almeida
    Madson Almeida avatar
    4 posts
    Registered:
    19 Mar 2021
    21 Apr 2021
    Link to this post
    Is it possible to remove a value in a lookup, based on another field?

       tpc.find("entps_pgrver_modalityid_1").get_kendoInput().setDataSource(ds);
       tpc.find("entps_pgrver_modalityid_1").get_kendoInput().dataSource.read();

    We used this to create and set the new datasource but It is stopping to update automatically when we select a field that the modality is dependent on.

    Many thanks,
    Madson Almeida
  2. Josh
    Josh avatar
    47 posts
    Registered:
    01 Jun 2018
    Answered
    03 May 2021 in reply to Madson Almeida
    Link to this post

    Hello Madson.

    It sounds like this is a great application to use a filter(s) on the FetchXML of the TPC Lookup widget! It is possible to filter the TPC Lookup based on the value(s) of other form widgets on the TPC Form. To add a filter based on the value of another widget, click Edit on the widget you are trying to filter in the TPC Form. Navigate to the Filters tab. Add a name to the filter, for example you can call it “FieldValue1” this will create a variable called @FieldValue1@. Under Filter Type select either Field Value or Optional Field Value depending on whether this filter should be required. For the value, select the field on which the value will be filtered and then click the + button to add the new filter. Now we have a variable called @FieldValue1@ which we can reference inside the FetchXML of the widget, it will automatically be replaced by the current value of the field. Within the TPC Fetch Builder of the widget, you can now add a FetchXML filter and reference the variable. Your fetch will look something like this:

    <fetch version="1.0" mapping="logical" output-format="xml-platform">
      <entity name="account">
        <attribute name="accountid" />
        <attribute name="name" />
        <order attribute="name" descending="false" />
        <filter type="and">
          <condition attribute="name" operator="eq" value="@FieldValue1@" />
        </filter>
      </entity>
    </fetch>
    

    Please let me know if you have any other questions!

    Cheers,
    Josh

     

2 posts, 1 answered