Change format for a specified record in data list

Michael W shared this question 1 year ago
Answered

I am trying to change the format (text color) of a specificrecord/field from within a data list, without having to tap on the record, and Ican’t get it to work.


· I can update the format for all records in a data list for aparticular field – no problem


· I can update the format in a data list for a particular fieldfor a selected record (by tapping on the row) – no problem


· I cannot figure out how accomplish this withouthaving to tap on the row – for example, I want to click OK on a message box andhave the format change for a specific record/field – I would have expected tobe able to do this via the select function, and selecting the record that Iwant to change, but this does not seem to work.


If it is not possible to be triggered by a separate messagebox, can it be done upon initial page load (whereby a particular record andfield can be in a different color text upon page load)? This could be a workaround if it cannot be accomplishedfrom a message box after page load.

Comments (6)

photo
1

Hi Michael,


You can do this by creating an On Page Load -> Change Style event. Then, create a condition that will be When.... [input 1] = [value of one of the input fields]. I have attached a screenshot of how this will look in the expression builder.


Let me know if you have any questions.


Best,

Danielle

photo
1

Danielle,


I expected it to work as you described and tried itseveral times before I submitted this issue. Today, I tried it again (several times), and cannot get it to work.


I have the event setup for format change to execute upontap of an OK button from a message dialog, with the desired field to be changedselected in the data. My testing resultsare as follows:


· With no Condition in front of the event, the textcolor of the field is changed for all records (test as expected, and confirmsthat my event is setup correctly)


· With a Condition as you described in front of theevent, and the Condition equal to the value of any record other than the first,no format changes occur (test failed)


· With a Condition as you described in front of theevent, and the Condition equal to the value of the first record, the field ischanged for all records (test failed – interestingly, this appears to suggestthat the Condition is only validated when it is the first record of the list(incorrectly – as it should work for any record), and it also incorrectlyupdates all records to the format change (not just the first record)).


I have tested this many times (including different fieldsin the data list), and can replicate the results each time. The positive result (first bullet) confirms that my Event is setup correct, and both of the failures confirm that there iseither an issue with my Condition statement, or there is a defect in the logicof the application. I have attached a picture of my Condition statement. Please advise.

photo
1

Hi Michael,


The event I described presumes that nothing will happen (i.e. the style won't be changed) if the condition isn't met. You need to create a condition for each object in the data list you would like to have change style. If possible, can you attach the prototype you're working on (or a version with just the data list) so I can take a look and see what might be going wrong? You can attach it in a .rar format.


Best,

Danielle

photo
1

Danielle,


You wrote “The event I described presumes that nothingwill happen (i.e. the style won't be changed) if the condition isn't met”, and”You need to create a condition for each object in the data list you wouldlike to have change style.” That has been myunderstanding all along and I agree with both points.


I am curious if you tested this prior to your response on4/20 or 4/18? If you had, I would bevery interested in seeing a copy of a prototype which shows this working as Idescribed. I cannot send you the fullprototype that I am working on due to confidentiality requirements. However, it took me less than 5 minutes tocreate a one-screen example which demonstrates the issue.


Upon reviewing the attached, you will find that I created3 test cases exactly as described in my last message – copied below is theexact same text from my last reply. Ofcourse, you will need to reload the simulation after each test. In all cases the event and the condition areon the OK button.


1. With no Condition in front of the event, thetext color of the field is changed for all records (test as expected, and confirmsthat my event is setup correctly)


2. With a Condition as you described in front ofthe event, and the Condition equal to the value of any record other than thefirst, no format changes occur (test failed)


3. With a Condition as you described in front ofthe event, and the Condition equal to the value of the first record, the fieldis changed for all records (test failed – interestingly, this appears tosuggest that the Condition is only validated when it is the first record of thelist(incorrectly – as it should work for any record), and it also incorrectly updatesall records to the format change (not just the first record)).


I am trying to achieve Test 2, and obviously, that shouldwork for any record. However, I couldalso make a workaround if Test 3 worked (first record). It is interesting that Test 2 and Test 3provide different results, even though they are essentially the same test.

photo
1

Hi Michael,


Apologies for the delay in getting back to you. I think I initially misunderstood your request as well - I thought you were referring to clicking on a label to change its style.


Anyway, to achieve what you're trying to do, you'll need to create a variable and an input field in which to write which field you'd like to change style. You won't be able to simply click on a button outside of the data list to change the style of one value within a data list.


I have attached an example of what this will look like. Check it out here: https://www.dropbox.com/s/t4r0hp3nc2hfq5s/DMSupportExample.vp?dl=0


Best,

Danielle

photo
1

Thanks Danielle - I was able to get this working using the approach from your example.