Randomizer - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Randomizer

Last post 10-01-2020 04:33 AM by erzon. 22 replies.
Page 1 of 2 (23 items) 1 2 Next >
Sort Posts: Previous Next
  • 09-26-2020 08:44 AM

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27

    Randomizer

    I want to get random code from other sharepoint list. Code list = list of all different coupon codes main list = ability to add coupon codes automatically as long the coupon code does not exist in the main list. How can I do this? so logic will be it will get the secondary data from code list then check if that coupon code is present from the main list if not it will show the random coupon
    Filed under:
  • 09-28-2020 07:44 AM In reply to

    I'd probably base this on the result of the now() function somehow. It returns data/time to the second. Perhaps grab the last two characters returned and add them, then have an XML file in your form that associates codes to numbers..... How many codes do you have?
    Hilary Stoupa

  • 09-28-2020 03:06 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27
    well it depends on how many lets say I have 200 different codes coupon. The logic would be everytime they add new items it will get automatically in that 200 list of coupons but before it will show it should check if that coupon exist in main list if not then it can select that coupon.
    Can you give me an example on how to do this? I added 2 secondary data for this one for the coupon and second for the main list also and add filter on the secondary data that it will get only the coupon if the coupon (listt)<> coupon(main list)
  • 09-29-2020 07:50 AM In reply to

    So - here is a rough sample that uses the last three digits of the date time and the count of the "coupons" in my XML file to randomly select one. Save the file locally, right click and select design, then you can preview.
    Hilary Stoupa

  • 09-29-2020 08:03 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27
    Thanks for the attachment. I saw your logic but that was not the one I need and also its not based on the time.
    New items - check the coupon secondary data to get the list of coupon. For example it gets coupon123 before it will show the coupon123 it needs to check again the Main list (Secondary data) if the coupon123 exist already or not. If not then that's the time the coupon123 will show but if it's already exist it will select another coupon then do same routine again.
  • 09-29-2020 08:14 PM In reply to

    I'm not sure how you are going to get a random item without some kind of logic to create a pseudo-random number.
    Hilary Stoupa

  • 09-29-2020 09:28 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27
    would it be possible to compare two secondary data if the items is not equal to 1st data and 2nd data then the coupon code will show
  • 09-30-2020 08:04 AM In reply to

    You can use XPath to check and see if an item from one data source is present in another data source, sure. Perhaps if you attach your template on a reply (under the options tab) I'll better understand what you are trying to do.
    Hilary Stoupa

  • 09-30-2020 08:12 AM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27

     Sorry but our network prohibit us to upload anything but your understanding is correct. I just need to check if the coupon is already exist from other data source list

     my logic here is like this  xdXDocument:GetDOM("random date")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Loan_x0020_number[xdXDocument:GetDOM("Randomizer")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:LOans != .]

     

    the results of this is always showing same coupon code even it exist in the other data source

  • 09-30-2020 12:54 PM In reply to

    If you want to see if there is no match in "random date" based on Loan_x0020_number equaling LOans, I'd try:

    not(xdXDocument:GetDOM("random date")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Loan_x0020_number[. = xdXDocument:GetDOM("Randomizer")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:LOans])

    Hilary Stoupa

  • 09-30-2020 01:00 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27

     I tried your xpath and the result shows "false" instead of the coupon code

  • 09-30-2020 01:08 PM In reply to

    Sorry, yeah, that is just going to return true and false. So - are there multiple rows in both data sources? Because if so, you'll always get the first coupon code from the random date data source....
    Hilary Stoupa

  • 09-30-2020 01:20 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27
    yes there are multiple rows in the coupon that is why I want the logic will scan all the rows and check if that coupon exist in main list is that possible?
  • 09-30-2020 01:33 PM In reply to

    Both of the data sources have multiple rows? "random dates" and "Randomizer"? The XPath I gave you returns true if there are no matches between the lists, and false if there are matches. I'm sorry I'm having such a hard time understanding what you are trying to do here. Can you try to describe it a bit more? Like: One list has values A,B,C,D. The other list has values E,B,D,A. I want to get back "C" from the first list because it doesn't exist in the second list. Or whatever the actual scenario is.
    Hilary Stoupa

  • 09-30-2020 01:50 PM In reply to

    • erzon
    • Top 500 Contributor
    • Joined on 08-02-2019
    • Posts 27
    Hilary Stoupa:
    Both of the data sources have multiple rows? "random dates" and "Randomizer"? The XPath I gave you returns true if there are no matches between the lists, and false if there are matches. I'm sorry I'm having such a hard time understanding what you are trying to do here. Can you try to describe it a bit more? Like: One list has values A,B,C,D. The other list has values E,B,D,A. I want to get back "C" from the first list because it doesn't exist in the second list. Or whatever the actual scenario is.
    Yes the two data source have multiple rows. Your scenario actually is correct. If the "random dates" have A,B,C,D,E,F,G,H coupon and the "randomizer" have A,B,D,E,F coupon already and the only remaining is C,G and H then the field can either pick C or G or H
Page 1 of 2 (23 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.