Answers.Body: <p>Assuming that <code>spaceId</code> is a dropdown field(??) I believe you'll want this:</p>
  <p><code>{spaceId.value|lower}</code></p>
  <p>If you dump out a dropdown field in a template you'll notice that it doesn't give you a simple value, but is a big complicated object that represents the field and its chosen value. Craft does some magic in the background if you attempt to output the field without specifying <code>.value</code>, in the same way it'll output entry/category <code>title</code>s if you output just its parent object. However if you want to use filters on the value you'll need to be more explicit about what you're outputting.</p>
  <p>If your <code>spaceId</code> field is not a dropdown but a relationship field (e.g., category select/entries select), then you'd need to fetch the related element first e.g.:</p>
  <p><code>{spaceId.one().title|lower}</code></p>
  <p>Bear in mind that subsequent changes to the space ID field won't dynamically move the uploaded assets to a new folder, so it might end up with very unpredictable results. Likewise if an editor decides to complete the upload field <em>before</em> selecting a space, I have no idea what'll happen then!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-11T10:40:03.907Z
Answers.Text: Hi James,  Actually it is just a plain text field. I tried all your suggestions plus variations but I couldn't get it work. Error: **The Photos field's Default Upload Location setting has an invalid subpath." What tag do I have to use for plain text fields?
  
  The information on this page are relevant but not offering a solution: https://craftquest.io/articles/twig-craft-cms-control-panel
Answers.UserDisplayName: flip
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-11T15:09:34.743Z
Answers.Text: Hm, ok... I've tested now with a plain text field using the same syntax as in your post, and it works ok for me!
Answers.UserDisplayName: James Smith
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-15T17:41:47.517Z
Answers.Text: I can confirm that for the text field my variable is working: **{spaceId|lower}**. I don't understand why it initially didn't work. Maybe something had been cached ...
Answers.UserDisplayName: flip
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-10T17:10:07.870Z
Answers.LastActivityDate: 2024-04-10T17:10:07.870Z
Answers.UserDisplayName: James Smith
Body: <p>The entry variable stores values such as S001-LU, S009-SH, etc. I use this variable as default upload folder for assets. I would like to lowercase the value from the field, i.e. s001-lu, s009-sh, etc. How can I do this?</p>
  <p>This doesn't work:
  <a href="https://i.sstatic.net/unuDL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/unuDL.png" alt="enter image description here" /></a></p>
  
Tags: <assets><variable><upload><craft5>
Title: How to lowercase the value of a variable used as default upload folder for assets?
ThreadText: # How to lowercase the value of a variable used as default upload folder for assets?
  
  (Asked by: username_0 on 2024-04-10)
  
  The entry variable stores values such as S001-LU, S009-SH, etc. I use this variable as default upload folder for assets. I would like to lowercase the value from the field, i.e. s001-lu, s009-sh, etc. How can I do this?
  
  This doesn't work:
  [![enter image description here](https://i.sstatic.net/unuDL.png)](https://i.sstatic.net/unuDL.png)
  
  **Tags:** assets, variable, upload, craft5
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-04-10. Score: 2 | Accepted answer
  
  Assuming that `spaceId` is a dropdown field(??) I believe you'll want this:
  
  `{spaceId.value|lower}`
  
  If you dump out a dropdown field in a template you'll notice that it doesn't give you a simple value, but is a big complicated object that represents the field and its chosen value. Craft does some magic in the background if you attempt to output the field without specifying `.value`, in the same way it'll output entry/category `title`s if you output just its parent object. However if you want to use filters on the value you'll need to be more explicit about what you're outputting.
  
  If your `spaceId` field is not a dropdown but a relationship field (e.g., category select/entries select), then you'd need to fetch the related element first e.g.:
  
  `{spaceId.one().title|lower}`
  
  Bear in mind that subsequent changes to the space ID field won't dynamically move the uploaded assets to a new folder, so it might end up with very unpredictable results. Likewise if an editor decides to complete the upload field *before* selecting a space, I have no idea what'll happen then!
  
  > **Comments:**
  > **username_0**: Hi username_1,  Actually it is just a plain text field. I tried all your suggestions plus variations but I couldn't get it work. Error: **The Photos field's Default Upload Location setting has an invalid subpath." What tag do I have to use for plain text fields?  The information on this page are relevant but not offering a solution: https://craftquest.io/articles/twig-craft-cms-control-panel  
  > **username_1**: Hm, ok... I've tested now with a plain text field using the same syntax as in your post, and it works ok for me!  
  > **username_0**: I can confirm that for the text field my variable is working: **{spaceId|lower}**. I don't understand why it initially didn't work. Maybe something had been cached ...  
  
  ---
  
  