Multivalued field

zezo2021

Member
Local time
Tomorrow, 01:56
Joined
Mar 25, 2021
Messages
415
Hello friends

How can I save the Multivalued field to the normal field string?
for example the value

1,2,3

can be normal string 1,2,2 without dropdown or anything related to a multivalue field

Thank you
 
Not sure what you mean. Would you like to do the same thing as a MVF without using a MVF? Obviously you can simply store the string "1,2,3", but then you really cannot do anything with it easy. Here is an example of a fake MVF that uses a normalized junction table.
You can do something like that where you store your values in a traditional table and then use the concatenate to display them.
 
Hello
example
I have a field containing multivalue
for example
category (multivalue)
1,2,3
5,6,3

I want to convert these value to short text field

category (multivalue) Cat(ShortText)
1,2,3 1,2,3
5,6,3 5,6,3
 
If I understand you correctly you have a MVF (lets call it 'MVF_Values') and now you have created a new text field in the same table (lets call it 'ConcatValues'). You want to take the MVF values and make a string with them and store it.
I can do this and have the code, but I am out this weekend for a wedding. If someone does not get back I can get to you by Sunday.
Basically
1. You will the recordset of your table.
2. For each record with the MVF you will get a second recordset. The value of the MVF field is a second recordset with the MVF values
3. You will loop the second recordset doing a simple concatenation.
4. You will do an insert query of the concatenated string into your new text field

See close example
 
Here is your example with slightly modified names to make it easier to read and a working query.
 

Attachments

The OP probably didn't like MVF and wanted to switch. I've found MVF to be most useful when I need a "choose all that apply" type of user input. A MVF is shown as a drop-down list of checkboxes, which is easy for the user to operate and to understand its purpose. For instance, a search form may allow the user to enter multiple search criteria. The user checks the choices on the drop-down list, and a query can be easily made for the selected choices by using a Recordset loop to construct a comma-separated list of the selected items, and then using the SQL:

Code:
SELECT * FROM MyTable WHERE field1 IN ( comma-separated list of user's choices );

Of course, MVFs are frowned upon because they are not "atomic" (I think that's the term) data required by traditional relational databases.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom