Change query based on a conditional - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » Change query based on a conditional Use our Google Custom Search for best site search results. Change query based on a conditional Last post 02-02-2023 11:34 AM by Hilary Stoupa. 9 replies. Page 1 of 1 (10 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 01-16-2023 08:27 PM larkino Joined on 03-21-2017 Posts 15 Change query based on a conditional Reply Contact Hello team, thank you for your support. I have a form, that since it is loaded, in a Drop-Down listbox a query to a Sharepoint list is executed, this results in a list of users according to the criteria of the list. Now, it is necessary for me to change this, since now I must change this query based on a conditional, that is, if a field A is equal to a certain criteria and a field B is equal to a certain criteria, in the resulting Drop-Down listbox You must change your query based on that combination or other combinations, is this possible in InfoPath? I await your comments, thank you. Filed under: dropdown list, drop-down list, drop down list, 2013 SharePoint Office365 Infopath2013, #infopath, #InfoPath2013 #SharePoint2013, #InfoPath2013 #SharePoint2013# 01-17-2023 08:02 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Change query based on a conditional Mark as Not AnswerMark as Answer... Reply Contact I think so - not enough detail to be 100% sure tho. I would say you need a rule on field A and one one field B. On both fields, determine what to set the query fields in your list connection to and execute the query to get a correct list for your dropdown. Hilary Stoupa 01-30-2023 07:44 PM In reply to larkino Joined on 03-21-2017 Posts 15 Re: Change query based on a conditional Query.png Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, thank you for your answer. Sorry for the delay in my response. I think I did not explain myself correctly, allow me to explain it in another way and provide more information. I have a field (Drop-Down List), which since it is loaded already comes with a query, this is its query. /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:Title = "NameArea" and d:u6cs = "BackUp"] According to the previous query, what it tells me is that it goes to the source list and brings the results that match the "Title" field and the "u6cs" field, and my question is if it is possible to change this query through some conditional in the Infopath rules manager in that field, for example. /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:Title = "otherNameArea" and d:u6cs = "BackUpB"] For example, if I have the Marketing area and within it there are two sub-areas that are "Editor" and "Graphic Designer", my query is oriented on how to update that query, for example I select "Marketing" and then "Editor" and it will bring me the results that meet that criteria, but if I change the subarea to "Graphic Designer", it will bring me all the criteria that it found with those results from that list. I hope to explain myself well. I am attaching screenshot of where I am getting that query to the sharepoint list and what is feeding my Drop-Down List. Thank you for your answer. Filed under: xpath, dropdown list, drop-down list, infopath forms, Infopath2013, Dropdown control, #infopath2013, #infopath, Sharepoint InfoPath Form, sharepointoint O365, InfoPath2013. SharePoint 0365, SharePoint Infopath2013, Infopath sharepoint online conditions rules, #InfoPath2013 #SharePoint2013, infopath form, sharepointint 2013 02-01-2023 07:17 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Change query based on a conditional Mark as Not AnswerMark as Answer... Reply Contact So you know, what you are talking about is not a query - it is an XPath filter. The data source has already been queried, and you are applying an XPath filter to the returned data. I'm still a bit confused, however. Will the data for the dropdown come from a different list if the subarea is Graphic Designer? Or does the data always come from the approvers list? If right now you are hardcoding in "NameArea" for the title, you could instead pick the field in the form where the user selects that value - that would make this dynamic. Feel free to attach a copy of your under the Options tab in a reply - it may be easier for me to understand and help you :) Hilary Stoupa 02-01-2023 01:30 PM In reply to larkino Joined on 03-21-2017 Posts 15 Re: Change query based on a conditional Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, a pleasure to greet you again, thank you for your answer and thanks for clarifying the concept of the XPath filter. About what you ask me, in the Sharepoint list there are these fields, NameArea (Name of the area), BackupType (Type of Backup) and Name (Who is the person), the drop-down brings me back according to the criteria that I entered the area but I have the "u6cs" field with the "Backup" criteria so that it brings as a result the name of the backup according to the area that we have entered. The detail is that when there is more than one record, it brings them all together and I cannot discriminate between them or select a specific name by means of a rule. What I want to do is that based on the name of the area and a new criteria (sub-area), to be able to bring only one record (a single name) but from a specific area and sub-area, all this from the same list. That is why my question is whether it is possible to make this XPath filter dynamic and how to do it. If I take the name of the fields from the image of the previous post, an example of how to make the dynamic filter would be as follows? */dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[(xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:NameArea = BackR2)*. I await your response and thank you again for all your effort and support. Filed under: xpath, infopath, dropdown list, drop-down list, sharepoint 2013, infopath forms, Infopath2013, InfoPath2013. SharePoint 0365, Infopath sharepoint online conditions rules, InfoPath 2013 02-01-2023 02:13 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Change query based on a conditional Mark as Not AnswerMark as Answer... Reply Contact Any chance I can see a copy of your form? Hilary Stoupa 02-01-2023 03:51 PM In reply to larkino Joined on 03-21-2017 Posts 15 Re: Change query based on a conditional Example.xsn Mark as Not AnswerMark as Answer... Reply Contact Sure. Thank you. 02-02-2023 08:20 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Change query based on a conditional scrn2.png Mark as Not AnswerMark as Answer... Reply Contact So - in the fields in the list connection you are using for the Backup dropdown, what field would match the selected Sub Area from the form? I see you are already filtering the dropdown on "ProductGroup" = "Backup" so I'm guessing it is not ProductGroup.... Hilary Stoupa 02-02-2023 09:03 AM In reply to larkino Joined on 03-21-2017 Posts 15 Re: Change query based on a conditional Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary, thank you for your answer. The "BackR2" field is where the XPath filter that would resolve the data is located, there the filter meets static and non-dynamic criteria as previously mentioned. This filter should obtain the ProductGroup and ResponsibleDepartment data when going to the list and currently it only searches statically. ProdcutGroups, only resolves the areas that are in a Sharepoint list. Thank you and regards. 02-02-2023 11:34 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Change query based on a conditional Example 20230202 HS.xsn Mark as Not AnswerMark as Answer... Reply Contact So - I'm sorry that I'm having so much trouble understanding what you want here. The data connection for the list you are using in your dropdown has to have a field that would have the same values as can be selected from ResponsibleDepartment - does that make sense? Maybe that's title? In which case, the filter would look like: d:Title = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:DepRes and d:u6cs = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:ProductGroup See the filter in the attached on backup 2. Right click the linked file, save locally. Right click the saved file and select Design to open in Design mode. Hilary Stoupa Page 1 of 1 (10 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Use our Google Custom Search for best site search results.